|
Is there a way to terminate the gets command the help file says that it's terminated by a new line which is then replaced by a null terminator....
Here's the thing, the string the reg_no goes into is set to [4], and if I remember correctly, if, when reading in a variable, if there isn't a null terminator it continues to collect data until full, gen protect, blue screen or it finds another. Which I assume is why when in testing if I set the reg_no to a123 and the surname to lastnamebob and then go to create a second student to see what information is stored in the first index of the array, I get
a123lastnamebob
lastnamebob
firstnamebob
So I'm assuming that somewhere in the search_for_account function, either by calling it or using a return, as I couldn't fathom anything else in there being the cause, that the return key press never counts until you enter the surname.
I've tried manually inserting a '\0' into reg_no[4] but that ends up wiping the surname for some reason, I've thrown new lines into the mixes, getch's, even some fancy smancy code thingy to only accept a return key press within the search_for_account function right before the return.
It seems like I'm almost on to something here, but it's just outta reach. Dunno if that makes any sense. Probably something small and I'll end up kicking myself for a while once I figure it out.
It should work, because it's based off of psuedocode that had to be done, verified and approved before I could start the coding, I would like to think the teacher isn't setting me up for failure.
Thanks for taking the time to read this and if you are able to point me in the right direction, thanks.
|