简体   繁体   中英

What happens if printf is not handled

I'm current supporting some legacy software written aeon ago, compiled in gcc 2.95.3. The program is ran in an SBC, occasionally I had to telnet into it to fix things. I notice that when the SBC is running on its own, it display some unexpected behavior eg missed executions.

When I do telnet in, slay the process and execute it manually, it stays fine that way. I'm suspecting that this has to do with performing printf without a proper terminal/console for it to print on.

If printf are not handled, what would be the effect of it?

可能是系统正在尝试打印到硬件串行端口(这确实很慢),并且当您使用TCP端口代替telnet时,才打印?

It depends on the stdio library you use, most will attempt to write to console anyway, so...

You should redirecting your STDOUT and STDERR to NULL or to a file, this should be quiet easy. gcc 2.95 was very stable so we can pretty much rule out any problems there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM