mcloan Posted November 25, 2006 Share Posted November 25, 2006 If I am using fwrite to write to a file, what is the best way to find the next blank row in the file so that it does not overwrite data already in the file?Your help is much appreciated. Thank you. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 25, 2006 Share Posted November 25, 2006 Open the file for append. When you start writing, all new records will be appended to the file.Ken Quote Link to comment Share on other sites More sharing options...
printf Posted November 25, 2006 Share Posted November 25, 2006 The file pointer is always moved to the end of the file, if you open it in 'a' mode. You can also use fseek ( $io, 0, SEEK_END ); when you might be using 'r+' mode.printf Quote Link to comment Share on other sites More sharing options...
simcoweb Posted November 25, 2006 Share Posted November 25, 2006 You can also use the fopen with the 'a' parameter which appends to the last row. The 'w' mode overwrites the entire file AND appends to the last row. Quote Link to comment Share on other sites More sharing options...
printf Posted November 25, 2006 Share Posted November 25, 2006 [quote author=simcoweb link=topic=116289.msg473739#msg473739 date=1164488984]You can also use the fopen with the 'a' parameter which appends to the last row. The 'w' mode overwrites the entire file AND appends to the last row.[/quote]very good [b]simcoweb[/b], I got my w mixed up, good catch! Quote Link to comment Share on other sites More sharing options...
simcoweb Posted November 25, 2006 Share Posted November 25, 2006 Thanks to you and so many others...i'm learning! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.