该消息
Segmentation fault (core dumped)是 不是 从你的程序来。
它是由外壳程序接收到的信号而产生的。它不是程序的 stderr 或 stdout 的一部分。
因此,shell的消息可以捕获为:
{ ./a.out; } 2> out_err
该消息
Segmentation fault (core dumped)是 不是 从你的程序来。
它是由外壳程序接收到的信号而产生的。它不是程序的 stderr 或 stdout 的一部分。
因此,shell的消息可以捕获为:
{ ./a.out; } 2> out_err