[plug] C, bad syntax etc.
    John Knight 
    anarchist_tomato at hotmail.com
       
    Tue Nov 19 09:05:11 WST 2002
    
    
  
I realised the error later on and took it out of the loop, but I still can't 
get fclose(); working, could you please give me a small amount of working 
code with headers included?
Make lunch, not war.
> > G'day all! I'm having quite  a few probs with file i/o here,
> > would someone
> > be able to troubleshoot this code?
> >
> >
> >   do
> >     {
> >     fptr = (fopen  ("num.dat", "wa+"));
> >     fprintf(fptr, " %d", number[count]);
> >     //flcose (fptr);
>
>fclose I assume no thte typo above - methinks you shouldn't be reopening 
>the
>file each time around the loop either. Stick the file open + error checking
>outside the loop.
>
>You should only need one of the args to fopen either w or a not both.
>
>fptr = fopen("num.dat", "w+");
>
>do
>{
>	fprintf(fptr, " %d", number[count]);
>	count++;
>}while (count < 9);
>return 0;
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail
    
    
More information about the plug
mailing list