www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/10/11:40:33

From: Neil Goldberg <ngoldber AT mitre DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help with input streams
Date: Mon, 09 Aug 1999 12:41:47 +0100
Organization: The MITRE Corporation
Lines: 18
Message-ID: <37AEBE7B.2D5D@mitre.org>
References: <7oles0$jda$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: mm58842-pc.mitre.org
Mime-Version: 1.0
X-Trace: top.mitre.org 934216770 16612 128.29.96.60 (9 Aug 1999 16:39:30 GMT)
X-Complaints-To: usenet AT news DOT mitre DOT org
NNTP-Posting-Date: 9 Aug 1999 16:39:30 GMT
X-Mailer: Mozilla 3.04 (WinNT; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie 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!
> 

infile.getline(my_buffer, max_characters);

The function stops either at a carriage return or max_characters
(make max_characters and your buffer size fairly large if you don't
want long lines to be broken into pieces).

moogla

- Raw text -


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