运行时错误到stderr或? (gcc ubuntu bash) [英] runtime error to stderr or ? (gcc ubuntu bash)
本文介绍了运行时错误到stderr或? (gcc ubuntu bash)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ ./test_fail
1
浮点异常
- 但这会让''somefile''零大小
$ ./test_fail 1> somefile
浮点异常
- 这会让''somefile''零大小
$ ./test_fail 2> somefile
1
浮点异常
- 为什么不''浮点异常''去stderr?
#include< stdio.h>
int main(){
printf("%d \ n",1);
printf("%d \ n",2/0);
返回0;
}
$ ./test_fail
1
Floating point exception
- but this leaves ''somefile'' zero size
$ ./test_fail 1>somefile
Floating point exception
- and this leaves ''somefile'' zero size
$ ./test_fail 2>somefile
1
Floating point exception
- why doesn''t ''Floating point exception'' go to stderr?
#include <stdio.h>
int main(){
printf("%d\n",1);
printf("%d\n",2/0);
return 0;
}
推荐答案
./ test_fail 1> somefile
浮点异常
- 这会使''somefile''零大小
./test_fail 1>somefile
Floating point exception
- and this leaves ''somefile'' zero size
./ test_fail 2> somefile
1
浮点异常
- 为什么不浮动p oint例外''去stderr?
#include< stdio.h>
int main(){
printf("%d \ n",1);
printf("%d \ n",2/0);
返回0;
}
./test_fail 2>somefile
1
Floating point exception
- why doesn''t ''Floating point exception'' go to stderr?
#include <stdio.h>
int main(){
printf("%d\n",1);
printf("%d\n",2/0);
return 0;
}
2008年7月19日星期六20:45:05 -0700(PDT),Isaac Gouy
< ig **** @ yahoo.comwrote:
On Sat, 19 Jul 2008 20:45:05 -0700 (PDT), Isaac Gouy
<ig****@yahoo.comwrote:
>
>
这篇关于运行时错误到stderr或? (gcc ubuntu bash)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文