File: 004_test_fopen64.c

package info (click to toggle)
cowdancer 0.90
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 648 kB
  • sloc: ansic: 4,593; sh: 407; makefile: 142; cpp: 5
file content (21 lines) | stat: -rw-r--r-- 352 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
fopen test */
#include <stdio.h>
#include <stdlib.h>

void writeandclose(FILE *a) {
	fprintf(a, "abc\n");
	fclose(a);
}

int main(int argc, char **argv) {
	/* test that the three args work. */
	if (argc < 4) {
		exit(1);
	}

	writeandclose(fopen(argv[1], "r"));
	writeandclose(fopen(argv[2], "w"));
	writeandclose(fopen(argv[3], "a"));
	return 0;
}