www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/15/15:59:35

Date: Thu, 15 Jul 93 13:41:19 MDT
From: gunter AT statsun DOT stat DOT ColoState DOT EDU (Gunter Hartel)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: rewind()

Hello

Would someone try out the rewind() function for me. The following segment
will read the file 'junk' only once under djgpp but twice under MSC and UNIX
(Sparcstation).  I'd like to be sure that I didn't make a mistake in the 
installation.  
I'm not too familiar with ANSI C and know nothing about C++ but the code seems 
to match my ANSI C manual.  I would appreciate any help on this.
Thanks muchly
Gunter

My compile command is:
gcc -m486 -lm -lc -lpc test.c

The program is:
#include <stdio.h>
FILE *input;
float temp;
main()
{
        printf("EOF = %d\n",EOF);
        input = fopen( "junk", "r");
        while (fscanf(input,"%f \n",&temp)!=EOF) {printf("ONE %f \n",temp);}
        rewind(input);
        while (fscanf(input,"%f \n",&temp)!=EOF) {printf("TWO %f \n",temp);}
}


- Raw text -


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