www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/22/16:00:22

From: Mark Phillips <umphill5 AT cs DOT umanitoba DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Reading from a file...
Date: Sat, 22 May 1999 14:09:24 -0500
Organization: The University of Manitoba
Lines: 19
Message-ID: <Pine.GSO.3.96.990522140453.26116A-100000@gold.cs.umanitoba.ca>
References: <uaB1cAATcoR3EwoG AT zaynar DOT demon DOT co DOT uk>
NNTP-Posting-Host: gold.cs.umanitoba.ca
Mime-Version: 1.0
X-Trace: canopus.cc.umanitoba.ca 927400175 10788 130.179.24.1 (22 May 1999 19:09:35 GMT)
X-Complaints-To: Postmaster AT cc DOT umanitoba DOT ca
NNTP-Posting-Date: 22 May 1999 19:09:35 GMT
In-Reply-To: <uaB1cAATcoR3EwoG@zaynar.demon.co.uk>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I've got a data file and can read words and numbers from it (each piece
> of data is on a separate line), and want to read a whole line of text --
> however, I can only get it to read up to the first space...
>  Any help will be greatly appreciated!

if you're using the C++ ifstream class, try getline().  i don't remember
if it's a member function:

an_ifstream.getline(a_string);

or just a regular function:

getline(a_string, an_ifstream);

one of those should work though.  if not, open up iostream.h and search
for getline and see how it should be done.

mark.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019