How do i load up a file into the C++ Script??
How to load up files With C++
Started by CPlusPlus, Aug 15 2007 11:11 AM
3 replies to this topic
#1
Posted 15 August 2007 - 11:11 AM
|
|
|
#2
Posted 15 August 2007 - 02:52 PM
Here is some code for you:
This is for Ansi C++ - what you wanted correct?
// Include the fstream library
#include<fstream.h>
int main()
{
// Create a String
char fileString[2000];
// Open the file
fstream fo("c:\\path\filename",ios::in);
// Loop through the reading
while(fo >> fileString)
cout << fileString ; // Display contents
// Close the file
file_op.close();
return 0;
}
This is for Ansi C++ - what you wanted correct?
#3
Posted 15 August 2007 - 04:06 PM
Yes, thanks alot!
#4
Posted 15 August 2007 - 04:09 PM
so how would i use it for like a background in the title screen of a game?


Sign In
Create Account


Back to top









