Hey guys,
Wondering if anyone can point me in the right direction as im almost a complete C programming Virgin.
Been asked to write a lottery program (using GCC compiler) that reads from an input file (Input.dat) and then processes the info to provide a report specifying :-
Date
winning numbers
sums of prizes per match
players name
multiple tickets
terminating line
Ive got a vague idea of how to work out the loops and arrays, however - im not sure how to get the data from the input file and put it into something i can use.
My attempt so far looks like this :-
Code:#Include <stdio.h> #include <string.h> Int Main () { Char text [25]; FILE *file_ptr; file_ptr = fopen ("Input.dat", "r+"); if (file_ptr !=NULL); { While fgets (char, 25, file_ptr) !=NULL) }
Is this the right way to open an input file ? and how do i use the numbers + text from the input ?
really confused.
oh, and the input file looks like :-
20 10 2007
4 15 25 27 33 40 20
10 78 2384 909414 119922
John Smith
6 8 15 17 23 33
4 15 26 27 40 46
8 11 25 27 33 40