"Now that my_app is running fine on Ubuntu, I'm trying again to run on
the Mac, but I actually get a Segmentation fault with the same
successfully built sources on the Mac."
When I go through my typical gdb session, it reports on the line
while(fgets(stream, StreamSize, stdin) != NULL){
regarding
fgets
My guess is that stream is NULL.
I dropped the -lm as you suggested Steve, and I still get the same
Segmentation fault (core dumped) with gdb complaining about fgets.
What about that -lc mentioned in man for fgets?
You don't need -lc.
On Nov 13, 2008, at 9:24 PM, Dee Ayy wrote:
Here is a sample of the strings being written to my_pipe from a MS
VC++ 6.0 compiled app, which runs in Wine from winehq.org on Mac OSX
shell X11.app. It parsed fine through my_app running on Ubuntu. It
runs intermittently on Mac OSX (apparently built by both cc and
Xcode).
Xcode uses gcc to compile.
Should I be concerned about porting the line endings when dealing with
fgets, strdup, strstr, strncpy, strtok, atof, char[], char* ?
They are supposed to be terminated by newlines \n sent by std::cout.
Also, although all these strings are written to my_pipe, after it
reaches fgets in my_app, only lines containing say GBPCHF are supposed
to filter through and continue parsing to get at the separate 1.7624
and 1.7633 and turn them into doubles. On the Mac, such filtering of
only GBPCHF lines is not happening.
OS X considers \n as the line ending although that has no effect on
strdup, strstr, strncpy, strtok, or atof, let alone character arrays
or pointers.
Does it matter if I #define _GNU_SOURCE when compiling on the Mac? It
did not seem to matter. If so, is there another switch I should be
using?
I would imagine it would depend on why you are defining that in the
first place.
(Of course there's no real reason to be using a pipe from the output
of cat here, just giving it as standard input would suffice. I just
wanted to demonstrate that the pipe works just fine.)
Without showing more code, it's pretty hard to guess what's going wrong.
HTH,
--
Steve Checkoway
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden