*****Listing 1*****

#include <stdio.h>
#include <stdlib.h>

main()
{
	FILE *out, *tmp;
	char ch;

	printf("Enter A (abort), E (exit): ");
	ch = getchar();

	tmp = tmpfile();
	fwrite("abcdefgh\n", 1, 9, tmp);

	out = fopen("TEST.DAT", "w");
	fprintf(out, "message to data file\n");

	fprintf(stderr, "error message to stderr\n");

	if (ch == 'A')
		abort();
	else
		exit(0);
}

