Mail Archives: djgpp/1998/01/13/17:50:20
From: | "Chia" <chia AT top DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | textfiles and datafiles, (again)
|
Date: | Mon, 12 Jan 1998 20:30:32 -0600
|
Organization: | Home
|
Lines: | 36
|
Message-ID: | <69gqol$t5m@nnrp3.farm.idt.net>
|
NNTP-Posting-Host: | max2-13.top.net
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Ok, I had a problem with a text file in an allegro datafile. I tried some
stuff when some people contacted me about it and I have a new problem now.
(such as)
Anyways, I had a function which I had posted last time which tried to read a
text file out of a datafile and store the words as card names in a typedef
struct.
[...]
file = fopen( DatFile[cardnames].dat, "r" ); // open the file
for(count = 0;count < NUM_CARDS;count++) // for each card
fscanf( file, "%s\n", &ALL_CARDS[count].The_Name );
[...]
I was informed that my fscanf() call should have not included the "&". I
recompiled and had the same results: the program ran fine but all of the
card names were blank.
So, I tried not using the datafile, but the text file itself. This yielded
a very strange result. All of the card names came up, but every time there
was a space in a name, it read it as a new card.
Example: a card name is "sample card"
The program loads "sample" into one card name, and "card" into the next card
name.
First off, I want to figure out why it does that and how to fix it. Second
off, I want to figure out how to fix the datafile file so that it works.
Any help is appreciated. Thanks!
chia AT top DOT net
- Raw text -