开发者

GCC : Segmentation Fault from Trim function

开发者 https://www.devze.com 2023-03-02 05:10 出处:网络
I got a gcc \"Segmentation Fault\" error with this script : http://paste2.org/p/1397204, why ? I tested this code with Visual C++ compiler and I don开发者_开发问答\'t get any error...Thanks to MByD a

I got a gcc "Segmentation Fault" error with this script : http://paste2.org/p/1397204, why ?

I tested this code with Visual C++ compiler and I don开发者_开发问答't get any error...


Thanks to MByD according to Getting Segmentation Fault topic.

Replace :

printf("|%s|\n", trim("  MyStringHaveToBeTrimmed  "));

With :

char str[] = "  MyStringHaveToBeTrimmed  ";
printf("|%s|\n", trim(str));

New code : http://paste2.org/p/1397248

0

精彩评论

暂无评论...
验证码 换一张
取 消