What is wrong?

James Mork numork at ndsuvax.UUCP
Tue Jan 24 12:08:40 AEST 1989


---
#include <stdio.h>
main(){
  FILE *fi, *ji;
  int i,j;
  fi=fopen("b:newtest.fil","w");
  for(i=0; i<200; i++) {
    j=putc(i,fi);
    printf("putting %d %d\n", i,j);};
  i=fclose(fi);
  printf("opening file for read...\n");
  ji=fopen("b:newtest.fil","r");
  for(i=0; i<200; i++) printf("i = %d  (read) = %d\n",i,getc(ji));
  i=fclose(ji);
};
---
  I am using TC 1.5 everything was going OK... Now... when I run
  a simple program like this, the file gets truncated after 25 or
  26 bytes...    After 25 when I read the file back in, I just
  get EOF (-1).  What is wrong?  Is this just some error that
  I am staring at, or is my compiler in foo bar land?
---
--
                  UUCP                Bitnet                Internet
          uunet!ndsuvax!numork    numork at ndsuvax     numork at plains.nodak.edu


#! rnews            597
Path: psuvm.bitnet!cunyvm!nyser!cmx!



More information about the Comp.lang.c mailing list