summaryrefslogtreecommitdiff
blob: cccdc43eec3df8a3a6b6f9e6977c015de605dfee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* $Header: /var/cvsroot/gentoo-src/portage/src/sandbox/problems/Attic/sandbox_muttbug.c,v 1.3 2003/03/22 14:24:38 carpaski Exp $ */

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

int main(int argc, char *argv[])
{
	FILE *fd ;
	
	printf("unlink\n");
	unlink("/tmp/test");
	printf("... done\n");
	
	printf("fopen\n");
	fd = fopen("/tmp/test", "a+");
	printf("... done\n");
	
	printf("fputc\n");
	fputc('7', fd);
	printf("... done\n");
	
	printf("fseek\n");
	fseek(fd, 0, SEEK_SET);
	printf("... done\n");
	
	printf("freopen\n");
	fd = freopen("/tmp/test", "r", fd);
	printf("... done\n");
	
	printf("fgetc ");
	printf("%c\n", fgetc(fd));
	printf("... done\n");
	
	printf("fseek\n");
	fseek(fd, 0, SEEK_SET);
	printf("... done\n");
	
	printf("fclose\n");
	fclose(fd);
        printf("... done\n");
        return 0;
}