- 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.
FILE*txt;
txt = fopen("textfile.txt", "r+");
fread(&temp, sizeof(temp), 1, txt);
fclose(txt);
strcpy(text, temp);
FILE*txt;
txt = fopen("textfile.txt", "r+");
fread(&temp, sizeof(temp), 1, txt);
fclose(txt);
strcpy(text, temp);
Jay S. wrote:...Okay, the code is working!!!
...but it's displaying the whole text file.
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);
Users browsing this forum: No registered users and 1 guest