I am trying to write my own shell. I am having problems with the user input part. I have made an array (char inputBuff[512]) and I want to read in user input. I am using ffputs() and ffgets() but I want to limit the person to the 512 size, and have it say it was an error and have them try again. I can not get the size restriction to work right.
fputs("Enter command: ", stdout);
fgets (prompt, sizeof inputBuff, stdin);
I had more than that, but I keep deleting and trying other ideas. I thought ffgets second argument would limit the input, but it doesn't. Any help is appreciated.