read/write to file

Ray Wallace wallace at ynotme.enet.dec.com
Tue Dec 4 10:48:24 AEST 1990


In article <12167 at milton.u.washington.edu>, amigo at milton.u.washington.edu (The Friend) writes...
>     I'm looking for examples on how to create files - putting sequential data

>     So I have 10 names & ages down in two arrays:
>     static int ages[10][]={.........};
This should be a single dimension array.
      static int ages[10]={.........};

>     fprintf(fp,"%s%d", names[10][], ages[10][]);
Try -
  for( next = 0; next < 10; ++next )
	fprintf( fp, "%s%d\n", names[next], ages[next] );

---
Ray Wallace		
		(INTERNET,UUCP) wallace at oldtmr.enet.dec.com
		(UUCP)		...!decwrl!oldtmr.enet!wallace
		(INTERNET)	wallace%oldtmr.enet at decwrl.dec.com
---



More information about the Comp.lang.c mailing list