pkirk25 wrote:
Robert Gamble wrote:
>>pkirk25 wrote:
[snip]
>>>Other than searching for a toekn at the top of the file, is ther a way
to reset the pointer to the top of the file without closing and
re-opening it?
Take a look at the rewind() function. You may also find the
fseek/ftell and fgetpos/fsetpos functions useful.
Robert Gamble
2 files with identical code
char *temp_string = malloc(254);
A strange "magic number." One hopes it is at least as
large as MAXLEN (and one wonders why MAXLEN wasn't used). One
might also wish for a check to see whether malloc() succeeded.
rewind(auctioneer_lua);
One guesses that auctioneer_lua is a FILE* value. Has it
been initialized? To something other than NULL?
fgets(temp_string, MAXLEN, auctioneer_lua);
printf("Please try again\n");
return 0;
In 1, this causes immediate crash - the printf never appears. In the
other, it works fine.
Sigh - time for a break.
After your break, consider whether someone seeing only the
snips and clips of your code has enough information to go on.
Do you know of the fable about the blind men and the elephant?
Each can feel a different part of the beast, and they all draw
vastly different conclusions as to its nature: like a snake, like
a tree, like a house, and so on. Don't force us to pet pachyderms.
--
Eric Sosman
es*****@acm-dot-org.invalid