fopen takes a mode, which is the "r" in this case.
"r" opens a text file for reading
"w" opens/creates a text file (it will discard previous contents)
"a" opens/creates a text file and places you at the end (append)
"r+" opens a text file for read and write
"w+" create a text file for read and write (it will discard previous contents)
"a+" opens/create a file for update and places you at the end
If you want that then I would use a for loop. The fgets will stop when the string it is reading is terminated. So just do this.
- Code: Select all
FILE * textFile = fopen("filename.txt", "r");
int i;
for(i=0;i<150;i++)
{
fgets(array[i], 255, textFile);
}
fclose(textFile);
You can't access the clipboard so you won't be able to copy things into a game, but you can simulate copy/paste within your game... but only in it.