File:  [MW Coherent from dump] / coherent / d / usr / src / examples / fileno.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <stdio.h>

main(argc,argv)
int argc; 
char *argv[];
{
	FILE *fp;
	int fd;

	if (argc !=2) {
		fprintf(stderr, "Usage: fileno filename\n");
		exit(1);
	}

	if ((fp = fopen(argv[1], "rw")) == NULL) {
		fprintf(stderr, "Cannot open input file %s\n",
		 argv[1]);
		exit(1);
	}

	fd = fileno(fp);
	printf("The file descriptor for %s is %d\n",
		argv[1], fd);
	exit(0);
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.