Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!stanford.edu!rutgers!bellcore!savage!garnett From: garnett@savage.bellcore.com (Michael Garnett) Newsgroups: comp.lang.c++ Subject: Re: Input Streams Message-ID: <1991Mar8.142332.9284@bellcore.bellcore.com> Date: 8 Mar 91 14:23:32 GMT References: <1991Mar7.211045.16370@linus.mitre.org> Sender: usenet@bellcore.bellcore.com (Poster of News) Reply-To: garnett@thumper.bellcore.com Organization: Information Networks Research (Bellcore) Lines: 31 In article <1991Mar7.211045.16370@linus.mitre.org>, ads@gateway.mitre.org (Alexas D. Skucas) writes: [...] |> |> For example, if I am reading from a file that has ten entries on a line |> and decided to skip to the next line after reading only two of the |> entries, how do I do it? |> [...] |> Alex |> ads@gateway.mitre.org use the ignore method of the istream class: ifstream F("somefile.txt"); /* code that reads the 2 entries ... */ F.ignore(255, '\n'); // eat up to 255 characters and stop after // extracting the '\n' // the use of 255 is arbitrary...I assume that // your text lines are going to be less than 255 // characters long. is that what you wanted? ------------------------------------------------------------------------ ********* Michael S. Garnett ** o ** Information Networks Research ** _- -_ ** Ph: 201-829-4591 ** / \ ** Internet: garnett@thumper.bellcore.com * | | * UUCP: ...!bellcore!thumper!garnett ** | | ** ** /_______\ ** // I speak for only myself, and NOT any company or ** o ** // organization directly or indirectly associated with ********* // Bell Communications Research