?
Solved

write function

Posted on 1998-10-30
4
Medium Priority
?
201 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 150 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

594 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