Page 2 of 2

PostPosted: Tue Jun 12, 2007 10:39 pm
by Sgt. Sparky
Code: Select all
FILE*txt;
txt = fopen("textfile.txt", "r+");
fread(&temp, sizeof(temp), 1, txt);
fclose(txt);
strcpy(text, temp);

is a code that
will work. :D

PostPosted: Wed Jun 13, 2007 12:55 am
by Jay S.
...Okay, the code is working!!! :D

...but it's displaying the whole text file. :shock:

Anyway to get it so it only displays a specified number of lines--as well as which line--from the file? This is the code I used:

Code: Select all
FILE*txt;
txt = fopen("textfile.txt", "r+");
fread(&temp, sizeof(temp), 1, txt);
fclose(txt);
strcpy(text, temp);

PostPosted: Wed Jun 13, 2007 11:15 am
by Sgt. Sparky
Jay S. wrote:...Okay, the code is working!!! :D

...but it's displaying the whole text file. :shock:

Anyway to get it so it only displays a specified number of lines--as well as which line--from the file? This is the code I used:

Code: Select all
FILE*txt;
txt = fopen("textfile.txt", "r+");
fread(&temp, sizeof(temp), 1, txt);
fclose(txt);
strcpy(text, temp);

use my line selecting code at the end of that(put the line function in global though)
then you can select it to copy the specefied text by selecting the target to text. :D

PostPosted: Wed Jun 13, 2007 1:59 pm
by Jay S.
Thank you for all your help, Sparky! :)

PostPosted: Thu Jun 14, 2007 2:03 pm
by Sgt. Sparky
you are welcome. :D