![]() |
| ||
| Reading text file and copying to new one. Bit file editing too. Hello, I'm trying to simply copy the text from one .txt and create a new one and copying it to a new txt. I'm actually adding more text to that new file but that's not the part I'm having problems with. I could go through the entire .txt with this #include <stdio.h>But I would like to read the source line by line, with a string long enough for the reading. Something like: char instring[101], fin;I just don't know what to put in the while or how else to read the file line by line until the end of the file. Knowing how many lines the source has might help, but I'm sure there's gotta be a beter way. In our class we're not using iostream.h, just stdio.h for I/O. Also, What's wrong with this piece of code: #include <stdio.h>What that code's supposed to do is change the people from table 5 to table 6 and viceversa. While doing the tracing I noticed that after it would find a guest with table 5 or 6, and it would do the fseek and or fwrite (can't tell when), it seems to go back up to the 2nd entry of the .DAT file. Any thoughts? Thanks in advance. |
| ||
| Re: Reading text file and copying to new one. Bit file editing too. Wonder if it could be possible for you to use ifstream and getline to get the lines and then use this line to put to you output file. This should read the file to the end. ifstream PS("SOURCE.TXT"); |
| ||
| Re: Reading text file and copying to new one. Bit file editing too. or this using FILE* char iobuf[255] = {0}; |
| All times are GMT -4. The time now is 2:58 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC