background process switches to stopped
I am writting an application to log user input. Like the .sh_history file, but a single file that logs the username and a timestamp.
My problem is that when I put the program into the background, it immidiatly changes to STOPPED. I can then fg or bg to bring it into the forground or background.
If I bring it into the forground, it continues to run. If I put it into the background, it immediatly stops again.
Any ideas as to what is causing it to stop?
EDIT: Code Removed