Hi again,
Working on my final assignemnt still and having issues getting my output to the screen the way it is required.
I have a text file I output my data to earlier in the program in this required format
Course Code
Subject Description
First Mark
Second Mark
Course Code
Subject Description
First Mark
Second Mark
This is what I attempted in order to read my four fields and print out on one line.
Code:
int printSubject()
{
//declare local variables
int i;
int fieldCOUNT = 0;
char line[31];
FILE *fp;
//Clears the previous screen and displays a column headers
system ("cls");
printf("\n\n Class Mark Sheet Pro Report \n\n");
printf("\n\n");
printf(" Course Code | Subject Name | First Mark | Second Mark \n");
printf(" -------------------------------------------------------------------\n");
//Opening the file for reading
fp = fopen(MarkFile, "r");
//Loop
while (fgets(line, sizeof(line), fp))
{
fieldCOUNT = fieldCOUNT + 1;
printf("%s ", line);
if (fieldCOUNT == 4)
{
printf("\n\n");
fieldCOUNT = 0;
}
}
getchar();
getchar();
return 0;
I get all my data but the out put is not what I had hoped for.
http://www.caricsolutions.com/progra...een_output.bmp
Any thoughts.
I do appreciate all the help I have recieved here on the board, I thought I should mention most of classmates have not handed this assignemnt in, or handed it in uncompleted becuase there is alot of functionality required that was not covered in our class. The three main resources I am using for this project are my notes, my text "C Programming a Visual Guide" and this forum.
I just don't want anyopne to think I am trying to get someone to write my assignment for me.
Thanks again.