🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.help
Article #8

Pointer arithmetic in C?

#8
From: Bill A. Oyler
Date: Mon, 21 Aug 1995 05:12
23 lines
1230 bytes
Hello,

Back in my Pascal days, I had absolutely no problem writing strings
(Str255s) to text files.  I would just do something like this:

        TextToWrite := 'hello, world!';
        Count := Length(TextToWrite) - 1;
        OSError := SetFPos(LogFileRefNum, fsFromLEOF, 0);
        OSError := FSWrite(LogFileRefNum, Count, @TextToWrite[1]);

What would be the C equivalent of this code??

Asside from the obvious syntax differences, all I changed was
"@TextToWrite[1]" to "&TextToWrite + 1".  Is there something more I need
to do?  I keep getting garble in my text file....

Thanks!!

=====================================================
Bill A. Oyler               People usually get what's
Minnetonka, MN, USA         coming to them ... unless
oylerb@tdkt.skypoint.net            it's been mailed.
=====================================================
Technical Details
Message-ID: <oylerb-2108950012310001@msp1-5.nas.mr.net>
Path: arc1-ca.pugleaf.net!msp1-5.nas.mr.net!user

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!msp1-5.nas.mr.net!user
From: oylerb@tdkt.skypoint.net (Bill A. Oyler)
Newsgroups: comp.sys.mac.programmer.help,comp.lang.c
Subject: Pointer arithmetic in C?
Date: Mon, 21 Aug 1995 00:12:31 -0500
Organization: The Dark Knight's Table BBS
Message-ID: <oylerb-2108950012310001@msp1-5.nas.mr.net>
NNTP-Posting-Host: msp1-5.nas.mr.net