From: johncc AT my-deja DOT com Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with input streams Date: Mon, 09 Aug 1999 17:56:24 GMT Organization: Deja.com - Share what you know. Learn what you don't. Lines: 25 Message-ID: <7on4o1$pd4$1@nnrp1.deja.com> References: <7oles0$jda$1 AT nnrp1 DOT deja DOT com> NNTP-Posting-Host: 204.254.32.135 X-Article-Creation-Date: Mon Aug 09 17:56:24 1999 GMT X-Http-User-Agent: Mozilla/3.01Gold (Win95; I) X-Http-Proxy: 1.0 x35.deja.com:80 (Squid/1.1.22) for client 204.254.32.135 X-MyDeja-Info: XMYDJUIDjohncc To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <7oles0$jda$1 AT nnrp1 DOT deja DOT com>, justinfl AT my-deja DOT com wrote: > I'm here with yet another stupid question, but i'm just starting, so > that's okay :) ....I'm trying to read a line of a text file. to my > understanding in c++ (djgpp compiler), i would use infile.read() or > infile.get().....i'm not sure of the exact syntax and the variables > involved. i'm also curious as to which of these two commands would be > best to read each line (80 chars) of a file, or if another command would > be simpler. Thanks for the help! > #include #include using namespace std; ifstream inputfile("test.dat"); string s; while ( getline( inputfile, s) ) cout << s << endl; cout << "Cheers,\nJohn\n"; Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.