| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
new to c++
Hello there
i am new to c/c++ and i want a small help about I/O + time i have this code ifstream sin ("/Data/rfont", ios::in); if(!sin) { cout << "cannot open rfont.\n"; return 1; } char line; char str2[255]; str2[255] = '\0'; while (!sin.eof()) { sin.getline(str2, 254, line); // SDL_Delay(10); cout << sin.tellg() << '\n'; } sin.close(); this code works fine for me, but i want to make it read the text file by time for example to read every x seconds and 1 line i dont have so mutch knowledge about c/c++ so if you can help me with this code i be very happy, even with some tutorial to look at about I/O & time thanks |
|
#2
|
|||
|
|||
|
maybe what i ask is difficult
so i ask a littlebit different how can i read this text over and over when read eof then starts to read from beginning and so on any idea? Quote:
|
|
#3
|
|||
|
|||
|
Quote:
Do you want to create an endless loop? |
|
#4
|
|||
|
|||
|
for tihs yes i want to read 2 texts over and over continuity
any idea ? |
|
#5
|
|||
|
|||
|
ifstream sin ("/Data/rfont", ios::in);
if(!sin) { cout << "cannot open rfont.\n"; return 1; } char line; char str2[255]; str2[255] = '\0'; int loop = 1; while (loop == 1) { sin.getline(str2, 254, line); cout << sin.tellg() << '\n'; } That should create an endless loop. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > new to c++ |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|