File: fopenf.c

package info (click to toggle)
libite 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,188 kB
  • sloc: sh: 4,665; ansic: 4,165; makefile: 141
file content (25 lines) | stat: -rw-r--r-- 489 bytes parent folder | download | duplicates (2)
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
#include "check.h"

int main(void)
{
	FILE *fp;
	char *dir = "/tmp";
	char *file = "__foo__";

	printf("Pass 1/2: fopenf() ===========================\n");
	fp = fopenf("w", "%s/%s", dir, file);
	if (fp) {
		fputs("foo", fp);
		fclose(fp);
	}

	fail_unless(fexist("/tmp/__foo__"));

	printf("Pass 2/2: fremove() ==========================\n");
	fremove("%s/%s", dir, file);
	fail_unless(!fexist("/tmp/__foo__"));

	printf("DONE =========================================\n");

	return 0;
}