[comp.sys.mac.programmer] C I/O differences

mac@ics.uci.edu (MAC ICS199 ACCOUNT) (01/04/89)

[coming from a Pascal programmer -- trying to port a C program...]

I'm trying to port a relatively simple C program to both ThinkC 3.0+ and
MPWC 2.0.2.  However, I'm getting two different results during a lseek
function.  ThinkC seems to adjust the EOF if the lseek is past the current
EOF, but MPW gives you an error (trying to seek past end of file). I'd like
the same behaviour as Think.

Does anyone know of a way to handle this? (I looked through the I/O libraries
but couldn't find a function which sets the end of file. My last resort
is to convert all the I/O to low level PBxxx calls, but I'd like to 
avoid that...). Thank to anyone, in advance.

(jeez, who said C was portable???)

Greg Finnegan
mac@ics.uci.edu

thecloud@dhw68k.cts.com (Ken McLeod) (01/05/89)

In article <3023@paris.ics.uci.edu> mac@ics.uci.edu (MAC ICS199 ACCOUNT) writes:
>I'm trying to port a relatively simple C program to both ThinkC 3.0+ and
>MPWC 2.0.2.  However, I'm getting two different results during a lseek
>function.  ThinkC seems to adjust the EOF if the lseek is past the current
>EOF, but MPW gives you an error (trying to seek past end of file). I'd like
>the same behaviour as Think.

 Remember that MPW C and THINK_C have different-sized ints (MPW's are 32 bits,
while THINK's are 16). lseek returns a long int. Could that be the problem?

>(jeez, who said C was portable???)

 The same guys who called it "pleasant, expressive, and versatile" :-)

-- 
==========     .......     =============================================
Ken McLeod    :.     .:    felix!dhw68k!thecloud@ics.uci.edu
==========   :::.. ..:::   InterNet: thecloud@dhw68k.cts.com
                ////       =============================================

uucibg@sw1e.UUCP (3929] Brian Gilstrap) (01/05/89)

In article <3023@paris.ics.uci.edu> mac@ics.uci.edu (MAC ICS199 ACCOUNT) writes:

[ Description of a problem caused by different behavior by LSC and MPW ]

>
>(jeez, who said C was portable???)
>
>Greg Finnegan
>mac@ics.uci.edu

Actually, if your estimation of the source of the problem is correct, then
it's the libraries that you are using which are incompatible.
That's the bane of programmers in any language.....sigh. :-/


Brian R. Gilstrap                     ...!ames!killer!texbell!sw1e!uucibg
                                      ...!bellcore!texbell!sw1e!uucibg
These thoughts and statements are     One Bell Center Rm 17-G-4
my own...my employer wouldn't         St. Louis, MO 63101
even think of thinking them...        (314) 235-3929