delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/04/11:52:05

From: n DOT o DOT s DOT p DOT a DOT m DOT thygesens AT post DOT tele DOT dk (Lasse Krogh Thygesen)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie Question - Convert string to numerical value
Date: Sat, 04 Sep 1999 15:25:58 GMT
Organization: Customer of Tele Danmark Internet
Lines: 34
Message-ID: <37d2388a.6478128@news.inet.tele.dk>
References: <37d32cc7 DOT 4183133 AT news DOT inet DOT tele DOT dk> <37d39de7 DOT 4581168 AT news DOT enter DOT net>
NNTP-Posting-Host: ip37.vjnxr1.ras.tele.dk
Mime-Version: 1.0
X-Trace: news.inet.tele.dk 936458800 12232 195.249.131.37 (4 Sep 1999 15:26:40 GMT)
X-Complaints-To: Department of Abuse <abuse AT news DOT inet DOT tele DOT dk>
NNTP-Posting-Date: 4 Sep 1999 15:26:40 GMT
X-Newsreader: Forte Agent 1.5/32.452
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Sat, 04 Sep 1999 04:37:00 GMT, sproctor AT enter DOT net (Sean) wrote:

This is very short version of my program, but it illustrates my
problem.

[start of code]

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main() {
        ifstream in("36.DAT");

        string NumberOfDataset;

        getline(in, NumberOfDataset);
        }

[end of code]


See I've tried declaring the NumberOfDataset variable as integer but
it won't work. The error was something about the getline command which
did not have a version where the NumberOfDataset variable could be an
integer.

The file I read from (36.DAT) has one number on each line, then there
is a linebreak. The odd thing is that the numbers has one space
character before and after them.


--- [www.lkt.person.dk] --- [www.maverick.subnet.dk] ---

- Raw text -


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