fgets() retrieves and stores the newline in the buffer - you have to strip it out:
Code:
char * get(char * buffer, unsigned max, FILE * stream)
{
char * crlf = 0, * line = fgets(buffer, max, stream);
if(line) crlf = strstr(line, "\n");
if(crlf) *crlf = 0;
return line;
}
Also, look at this:
>> char *scenarioNum;
>> gets(scenarioNum);
'scenarioNum' doesn't point to any memory!
Don't use gets() either, since it doesn't provide buffer-overflow protection.
Finally, look at the code that copies a file - wouldn't that make a great 'reusable' function? [hint hint]