By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.


P: 2
I'm programing in c, in the first part of the program I write data to a file, using fopen() and fclose(). In the second part I am trieng to read the file, again, using fopen() and fclose() in reading mode. the program start reading from the last raw. using rewind() does not help. how can I start reading data from begining of file?
Sep 29 '06 #1
Share this Question
Share on Google+
3 Replies

P: 44
Maybe fscanf() will help, try it.

Sep 29 '06 #2

P: 2
Thank you
fscanf() &fprintf() is whatIm doing. still I think it has to do with rewind(), as if the rewind() take me back to the last raw instead to the begining of the file.
Sep 30 '06 #3

Expert Mod 5K+
P: 8,916
try using fseek instead of rewind, it will give an error indication if it can't set the file pointer to the start of the file. Additionally you need to make sure you have opened the file to read in the correct mode.
Sep 30 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.