printf works under lldb but not otherwise

I have a simple C program that has printf statements.
It produces zero output.
However when it’s run under lldb, it prints correct output. How could this be?

I tried replacing the printf statements by “fprintf” to a file: same behaviour -
no file created and no output, but under lldb, the file is created with correct output data.

Peter R

The only thing I can think if is stdin/out/err are not setup correctly when launched out of the debugger. How does your program get launched? From a terminal on the command line?

printf will call fprintf() under the covers with stdout as the file handle. Maybe “stdout” can be checked for NULL with an if statement in your code? The theory would be that “stdout” would be null when not run under the debugger, and would be with run in lldb?