• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Unix/C++ question

Deeko

Lifer
Here's the predicament...I'm writing a program for an assignment, and it is to run in the background, however it also is supposed to prompt the user for data at the beginning. Using cin or getline, it prompts, but when you enter anything, it treats it as a command and says "command not found" and stops the program. Any solutions?
 
i'm putting the program in the background using &.

the source for the input simply is

cout << "Enter the desired disk quota: ";
getline(cin, input);
 
Do you have to start it in the background? If not, the easiest way would be to start the program in the foreground (not use the &amp; ), collect the necessary data, then use something like exec() to put the program in the background using the "BG" command..
 
If you're putting it in the background with &amp; right off the bat, your input is probably being parsed by the OS. Enter the "Disk quota" as "ls" and see what happens 🙂
 
Back
Top