Originally posted by Wolkec
This thread may soon be closed if you won't take the advice.
int main () { string line; ifstream fp("c:\\Vaja.ini"); if (fp.is_open()) { while (! fp.eof()) { getline (fp, line); if (line[0] == '[') { // this is player cout << line << endl; } } fp.close(); } else cout << "Vaja.ini doesn't exist or it cant be opened.\n"; system("PAUSE"); return EXIT_SUCCESS; }
int main () { string line; //code if (line[0] == '[') { //code }
string line;
char line[20]; //20 is just an example, you can have it any size you want
if (myarray[0]=="[") { // get the USER string here until you find "]" }
#include <_stream> //note this underscore represents a missing letter as well! #include <iostream> using namespace std; int main () { _ _ _ _ line[50]; _ _ _ _ _ _ _ _ fp("c:\\vaja.ini"); if (fp.is_open()) { _ _>> line; _ _ _ _<< line << endl; system("PAUSE"); //OR cin.get(); (cin.get() is better programming unless you specifically want the user to press any key not just enter) } if (!fp.is_open()) { _ _ _ _ << "Vaja.ini doesn't exist or it cant be opened.\n"; system("PAUSE"); } }
#include <_stream> //note this underscore represents a missing letter as well! #include <iostream> using namespace std; int main () { _ _ _ _ line[50]; _ _ _ _ _ _ _ _ fp("c:\\vaja.ini"); if (fp.is_open()) { _ _>> line; _ _ _ _<< line << endl; system("PAUSE"); //OR cin.get(); (cin.get() is better programming unless you specifically want the user to press any key not just enter) } if (!fp.is_open()) { _ _ _ _ << "Vaja.ini doesn't exist or it cant be opened.\n"; system("PAUSE"); } }
#include <_stream> //note this underscore represents a missing letter as well! #include <iostream> using namespace std; int main () { _ _ _ _ line[50]; _ _ _ _ _ _ _ _ fp("c:\\vaja.ini"); if (fp.is_open()) { _ _>> line; _ _ _ _<< line << endl; system("PAUSE"); //OR cin.get(); (cin.get() is better programming unless you specifically want the user to press any key not just enter) } if (!fp.is_open()) { _ _ _ _ << "Vaja.ini doesn't exist or it cant be opened.\n"; system("PAUSE"); } }
Comment