c types problem

Herb Kanner kanner at tymix.UUCP
Thu Jan 9 08:18:22 AEST 1986


In article <1237 at gitpyr.UUCP> ken at gitpyr.UUCP (Ken Hall) writes:
>May I ask a stupid question?  Would somebody post or send me a very short
>C program that open a file, write something to it, then closes it?
>
>Thankyou in advance.

#include <stdio.h>

main()
{
	FILE *file;

	filex = fopen("THING", "w");  /* opens file named THING for writing */
	putc('a', filex);	/* puts char 'a' in file pointed to by 'filex' */
	fclose(filex);	/* not necessary; end of program closes file */
}

	

-- 
Herb Kanner
Tymnet, Inc.
...!hplabs!oliveb!tymix!kanner



More information about the Comp.lang.c mailing list