source: liacs/da/opdr2b/write12.cc@ 386

Last change on this file since 386 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 974 bytes
Line 
1/* Author : Rick van der Zwet
2 * S-number : 0433373
3 * Version : $Id: compressie.cc 330 2007-11-25 23:31:30Z rick $
4 * Copyright : FreeBSD Licence
5 */
6#include <stdio.h>
7#include <errno.h>
8#include <stdlib.h>
9#include <sysexits.h>
10#include "fileio.h"
11
12
13/* XXX: File are only checked at creation time, not during execution */
14int
15main(int argc, char ** argv)
16{
17 FILE * output;
18
19 int number;
20 int temp;
21
22 if (argc < 3) {
23 fprintf(stderr, "Usage: %s <outfile> <number1> [<numberN>]\n",argv[0]);
24 return(EX_USAGE);
25 }
26
27 output = fopen(argv[1], "w");
28 if (output == NULL) {
29 fprintf(stderr,"Error: Unable to use `%s', errno: %i\n",
30 argv[2], errno);
31 return(EX_CANTCREAT);
32 }
33
34 for (number = 2; number < argc; number++) {
35 temp = atoi(argv[number]);
36 printf("%i ", temp);
37 tofile(output, temp);
38 }
39
40 closefile(output);
41 printf("\n");
42 fclose(output);
43
44 return(EX_OK);
45}
46
Note: See TracBrowser for help on using the repository browser.