![]() |
|
#1
|
|||
|
|||
C binary file programI'm writing a program to store information about students using structures. We store the information in a binary file. I am getting some compiler errors using the unix machines at school. I can't see the errors that it is giving me. Any help would be greatly appreciated.
Here are the errors: project2.c:17: two or more data types in declaration of `student' project2.c: In function `delete': project2.c:62: `rec' undeclared (first use in this function) project2.c:62: (Each undeclared identifier is reported only once project2.c:62: for each function it appears in.) project2.c: In function `print': project2.c:114: warning: assignment makes integer from pointer without a cast project2.c:115: request for member `print' in something not a structure or union project2.c:142:2: warning: no newline at end of file CPP / C++ / C Code:
Last edited by dsmith : 10-Oct-2004 at 17:38.
Reason: Please use [c] & [/c] for syntax highlighting
|
|||
|
#2
|
|||
|
|||
|
Quote:
Same answer as you got on the other board: missing semicolon at end of struct{} definition. Regards, Dave |
|
#3
|
||||
|
||||
|
In addition, your use of printf isn't correct. Printf is not an input function only an output function. You need to use a some kind of input function here. I would use fgets...
CPP / C++ / C Code:
__________________
The best damn Sports Blog period. |
|
#4
|
|||
|
|||
|
Quote:
Yeah, there are lots of things that require some work. I thought if he could get past the compiler errors, most of the errors will be made visible as he starts to execute the program. In particular, the error message caused by the missing semicolon was typically uninformative, but after a while you get a feel of how these things happen. Regards, Dave |
|
#5
|
|||
|
|||
|
hmm, ok I've tried doing the printf debugging and it seems that I have some major problem when I'm trying to enter the name using
Code:
when entering the info it does prints "Enter name" and then goes straight to Enter ID... it doesn't give the user a chance to enter a name when I use printf to check name its just all empty spaces... Thanks for the help! |
|
#6
|
||||
|
||||
|
Hi Newworld. I have always struggled with the scanf function. Is there a scanf function prior to this fgets call? Scanf does not clear the newline from the input buffer.
I would recommend changing everything to use fgets. Once you read a string, you can convert it to an integer using atoi. __________________
The best damn Sports Blog period. |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CD burner wont burn!! | robertli55 | Computer Hardware Forum | 1 | 18-Jun-2004 11:53 |
| Yet another CD burner problem: Lite-On LSC-24082K | Erwin | Computer Hardware Forum | 1 | 22-May-2004 12:28 |
| Can't view pages from another machine on the Intranet | aevans | Apache Web Server Forum | 9 | 14-May-2004 03:26 |
| Re: Programming Techniques | WaltP | C Programming Language | 0 | 10-Mar-2004 00:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The