C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 2nd, 2004, 10:50 AM
ppap ppap is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 ppap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old August 6th, 2004, 10:13 AM
ppap ppap is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 ppap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
Originally Posted by ppap

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();

Reply With Quote
  #3  
Old August 7th, 2004, 09:03 PM
ddeile ddeile is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 ddeile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by ppap
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?


Do you want to create an endless loop?

Reply With Quote
  #4  
Old August 9th, 2004, 04:25 AM
ppap ppap is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 3 ppap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
for tihs yes i want to read 2 texts over and over continuity
any idea ?

Reply With Quote
  #5  
Old August 9th, 2004, 09:39 PM
ddeile ddeile is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 9 ddeile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > new to c++


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT