files

i'm trying to create a file in C++ using <stdio.h> and when i wrote the codes, complie the program everyhting seems fine but after running it and yes the file was created but when i checked it the numerical figures weren't there atleast the ones that i inputed in the program but there was some other figure that weren't entered and when i try to read the file using the same program it stop respoding. i used a switch statement and function protypes..the codes i used to read the file. this function was called with-in a case.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void retriveclasslist()
{
FILE*pFile;
/*pFile file pointer*/
char frist_name, last_name;
int class_number;
float amountpaid;
if ((pFile= freopen ("class.txt","r+",stdin))== NULL)
printf ("file could note be opened");
else 
printf ("enter vistor's name\n");
scanf ("%s", frist_name);
fscanf (pFile,"%s",frist_name);
printf ("%s",frist_name);
fscanf (pFile,"%s%s%f%d", first_name, last_name, &amountpaid, class_number);
fclose (pFile);
system ("sclr");
menu ();
getchar ();
}


could i please get some info on what to do or what could be missing from my program. my email in on my profile.
Last edited on
Post formatted code within code tags. Noone wants to try and decipher that post. It is too hard to read.
Topic archived. No new replies allowed.