delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/23/14:18:04

From: "Jesper Lund" <jl1204 AT worldonline DOT dk>
Newsgroups: comp.os.msdos.djgpp
References: <01c14445$8cc5f3e0$bc8684d5 AT feta> <01c14449$4c5c3fe0$bc8684d5 AT feta>
Subject: Re: what's the equivalent of <iostream.h> for gpp ?
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <Ozpr7.4647$t8.294099@news010.worldonline.dk>
Date: Sun, 23 Sep 2001 20:09:49 +0200
NNTP-Posting-Host: 213.237.1.23
X-Complaints-To: news-abuse AT wol DOT dk
X-Trace: news010.worldonline.dk 1001268590 213.237.1.23 (Sun, 23 Sep 2001 20:09:50 MET DST)
NNTP-Posting-Date: Sun, 23 Sep 2001 20:09:50 MET DST
Organization: Customer of Tiscali A/S (World Online)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Gwen <mb11363 AT chello DOT be> wrote in message
news:01c14449$4c5c3fe0$bc8684d5 AT feta...
> > I'm experiencing some problems with stdio.h and I want to use
iostream.h,
> In fact, I think I'll have the same problems with iostream.h : I can't
> recognize when I read a file when there is a carriage return.
> I tried this :
>
> int c=getc(f);
> while (c!=13) { addch(c); }
>
> It displays all the characteres of my files, with the cariage return but
it
> doesn't break the loop and it reachs the end of file and loops forever.
>

I would suggest that that you post the minimal code example which reproduces
your problem (and can be compiled). The above two lines of code would indeed
loop forever as the integer variable c is never modified (unless addch is a
C++ function which takes an int& as argument).

If you want to read characters from an ascii files until the next carriage
return, you can use the function getline() in either C or C++.



- Raw text -


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