Thanks for all the tips Simon.
Yes, it was the exclamation mark. I'd of course only looked at the trigraph
documentation and therefore thought that exclamation was unaffected by the
CCSID issue. Ignorant of me.

Thank you,
Erik

2009/10/3 Simon Coulter <shc@xxxxxxxxxxxxxxxxx>


On 04/10/2009, at 3:01 AM, Erik Olsson wrote:

After being unable to get a successful compile on a 6.1 machine due
to ccsid
issues I used trigraphs for curly braces etc. The compilation then
went
fine, but...

I have the following code.

fb = _Rreadf(fp, &buf, sizeof(buf), __NO_LOCK);
if (fb->num_bytes != sizeof(buf))
??<
cout << "That did not work" << endl;
_Rclose(fp);
return -1;
??>

The bizarre thing is that the if statement always evaluates to true
(even if
the read finds a record, and even if i change the comparison to
"==". That
truly defies the rules of logic).
Other if statements in the same program work as expected. It's
created with
CRTBNDCPP.
I have tried the program successfully on a V5R4 machine.

Guess it's time to check this with IBM?

I think the exclamation mark is a variant character. Depending on your
source file CCSID you may need to use an alternative token (e.g.,
not_eq). See page 12 of the VRM610 ILE C/C++ Language Reference.

Just some other thoughts:

What is the value of fb=>num_bytes after a successful read?

What does errno contain when the line of code fails?

Is the code above a direct copy/paste of the real code or do you have
a dangling semicolon after the if test?

Did you run the identical 610 code on 540 or did you re-enter it?

Is the source file CCSID and run time CCSID the same on 540 and 610?

Is the run-time language ID the same on 540 and 610?

Did you try compiling for 540 on the 610 system? Did it make a
difference?

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------



--
This is the C programming iSeries / AS400 (C400-L) mailing list
To post a message email: C400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.



This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].