www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/30/07:47:28

From: deanh AT zip DOT com DOT au (Dean)
Newsgroups: comp.os.msdos.djgpp
Subject: Reading in a file
Date: Sun, 30 Nov 1997 11:36:34 GMT
Organization: The Zipsters
Lines: 36
Message-ID: <34814e4c.33917112@news.zip.com.au>
NNTP-Posting-Host: 203.62.148.157
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Here's an example of a file I want my program to read:

"B02304Y8412","01:37","26-11-97"
"B02321X8412","01:37","26-11-97"

I tried the following code:

input = fopen( filename, "rt" );

while( fscanf( input, "\"%s\",\"%s\",\"%s\"\n", code, time, date ) )
{
  //do stuff to code, time and date
}

but the loop is never entered.

I also tried the following C++:

ifstream input;
input.open ( filename, ios::nocreate );

while( !input.eof() )
{
  input << "\"" << code << "\",\"" << time << "\",\"" << date << "\"\n";

  //do stuff to code, time and date
}

but the same thing happened.  I also tried removing all the \" but
still nothing.

PLEASE HELP!!

Dean.

PS I'd rather a reply via email...

- Raw text -


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