input/output trouble cause segmentation fault

Dmitry Andreychuk and.dmitry at gmail.com
Thu Jul 21 18:49:02 UTC 2011


On Tue, 2011-07-12 at 22:48 -0700, eric wrote:
> Dear advanced c/g++ programers:
> 
>   A program request me to enter twice input
> that program probably is tested good on visual c++ 7.1 on window xp,
> but my system is g++ on linux(Ubuntu10.04)
> It assume
> Enter some strings: a b c d
> ^Z
> Enter some more strings: d e f g
> ^Z
> Union: a b c d e f g
> Difference: a b c
> Intersection: d
> all these you can get from page 273 and 274 of book(c++ cookbook)
> 
> but my test result is
> -------------------------------
> eric at eric-laptop:~/cppcookbook/ch7$ ./a.out
> Enter a series of strings: a b c d
> ^Z
> [7]+  Stopped                 ./a.out
> eric at eric-laptop:~/cppcookbook/ch7$ ./a.out
> Enter a series of strings: a b c d
> {a, b, c, d}
> Segmentation fault
> -------------------------------------------------------------------
> second case , I used <Enter><Control-D>
> first case, I used <Enter><Control-Z>

Sorry for a late answer.
I've just run it and had no segfault (using <Enter><Control-D>).
Ubuntu 11.04; g++ 4.5.2-1ubuntu3
Try debugging it with gdb.


-- 
Dmitry Andreychuk





More information about the Ubuntu-devel-discuss mailing list