Question
Write a complete (with all necessary declaration) function called loadMyIncome that: requires an argument as a char pointer to the file name. The function must
Write a complete (with all necessary declaration) function called loadMyIncome that:
requires an argument as a char pointer to the file name.
The function must open the file named in the argument for reading,
Must insure that the file was opened successfully.
Must read the file line by line using fgets storing the read data in char array called myLine assuming that no line is longer that 80 characters (some may be exactly 80 characters long)
Must continue reading until it encounters the end of file.
(Hint use the following syntax for fopen and fgets
FILE * fopen ( const char * filename, const char * mode );
char * fgets ( char * str, int num, FILE * stream );)
Also, please note that you are to write the function only. This means that you do not have to write a main().
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started