Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

write function

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why adding test code changes the build ? 11 132
how to understand recursion 12 229
How to programmatically differentiate between C and Java 10 204
Arduino EDI - Programming language 3 103
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

791 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