Solved

write function

Posted on 1998-10-30
4
191 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 opening and reading files in the C programming language.

708 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

19 Experts available now in Live!

Get 1:1 Help Now