Yurttas/PL/IL/C/F-mar11/05/01/10/00/get list int.c

 1/*
 2   Copyright(C) 1998
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : January 1, 1998.
11   authorĀ : Salih Yurttas.
12
13   get_list_int.c
14*/
15
16
17#include "get_put_list_int.h"
18
19int get_list_int(int list[]) {
20
21  FILE *in_file;
22  char filename[MAX_SIZE_STRING];
23
24  int i;
25
26  printf("\n--> input filenameĀ : ");
27  scanf("%s",filename);
28  printf("\n");
29
30  in_file = fopen(filename,"r");
31
32  if(in_file==NULL) {
33    printf("cannot open %s\n",filename);
34    exit(1);
35  }
36
37  i = 0;
38  while(fscanf(in_file,"%d",&list[i])!=EOF)
39    ++i;
40
41  return i; /* number of input items counted. */
42
43}