i have a little program which takes a keyboard input from fgets() and puts it in a string (char cmdLine[15])
it then passes that string as a command line to a program which loads the bitmap specified by the command line
the problem is that i dont know how to edit the string so that if i dont enter a full 15 characters, it wont pass along NULL characters and all that.
what i mean is that if the filename I pass along is "picture.bmp", the bitmap loader will tell me that it cant find the file:
"picture.bmp
"
notice there is a newline included there, i assume that the newline is being passed along in the char.
here is the launcher:
Code:
#include <stdio.h>
#include <process.h>
int main()
{
char cmdLine[15];
printf("Command Line: ");
fgets(cmdLine,sizeof(cmdLine),stdin);
spawnl(P_OVERLAY,"unchain4.exe","unchain4.exe",cmdLine,NULL);
return 0;
}
obviously, cmdLine contains some unwanted characters, but how do i get rid of them?