Solved

write function

Posted on 1998-10-30
4
192 Views
Last Modified: 2010-04-15
i'm having trouble getting data to write into my structure. i hope somebody could help asap.  below is my code and i thought i'm using the function right.  please help.
/**********CODE STARTS HERE************/
0
Comment
Question by:zandyl
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:kellyjj
ID: 1253911
could you please be a little clearer.  A quick look over doesn't show anything blantly wrong.
0
 

Author Comment

by:zandyl
ID: 1253912
hi kellyjj,
i know, that is my problem.  it doesn't look like i'm doing anything wrong, but when i try to add a new record, it gives me the error"WRITE ERROR APPEND", w/c means it didn't write the record yet it looked like it wrote it.  Then when i try to retrieve the same record to modify if so it will write the time in the next time slot in the structure, it looks like it doesn't read the flag (tmptr) and it give me an error again when i write it back!!  i'm really stuck and i have no idea why??  please help.
thanks a bunch.
zandyl
0
 
LVL 2

Accepted Solution

by:
kellyjj earned 50 total points
ID: 1253913
ok,  I looked at the man pages on fopen.   for your flag try

"r+"  this flag is for updating and allows both reading and writing, although you will be responsible for where this happens.  When you use a+  when ever you write the write will always be done at the end of your file.  Looking at your code it looks like you are trying to set the pos and then write.  

I hope this helps
0
 

Author Comment

by:zandyl
ID: 1253914
hi kellyjj,
i already tried that even before you got to answer me back.  i thought it was also my problem, i changed my fopen with an 'r+' and still it didn't work.  was my problem is where my pos=ftell(fp) line in code.  i tried several places and nothing helps. any other ideas?
thanks.
zandyl
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I test for current date? 9 95
Binary Bomb: Phase 4 func4 3 310
Read file descriptor 3 in C 14 104
valid enum? 6 73
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now