🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #2637

Re: putchar() getchar() problem?

#2637
From: Steven Grimm
Date: Wed, 26 Jul 1989 21:51
20 lines
1244 bytes
In article <2829@tahoe.unr.edu> mikew@wheeler.UUCP (Mike Whitbeck) writes:
>HELP ! 
>I seem to get extra \r's from putchar()!!!! (or getchar()?)

On the ST, the end-of-line code is \r\n, not just \n as it is on UNIX.
In order to output valid text files, C libraries translate \n to \r\n
on output, and back the other way on input.

Most C compilers on the ST let you pass a "b" modifier to in the second
parameter of fopen(); this tells the compiler to skip its I/O translation.
For instance, you'd say

fp = fopen("filename", "wb");

Hope that helps.

---
This message is a figment of your imagination.  Any opinions are yours.
Steven Grimm		Moderator, comp.{sources,binaries}.atari.st
sgrimm@sun.com		...!sun!sgrimm
Technical Details
Message-ID: <33978@grapevine.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!sun-barr!newstop!sun!grapevine!panarthea!koreth
References: <2829@tahoe.unr.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!sun-barr!newstop!sun!grapevine!panarthea!koreth
From: koreth@panarthea.sun.com (Steven Grimm)
Newsgroups: comp.sys.atari.st
Subject: Re: putchar() getchar() problem?
Keywords: extra CR's, MWC
Message-ID: <33978@grapevine.uucp>
Date: 26 Jul 89 21:51:35 GMT
References: <2829@tahoe.unr.edu>
Sender: news@grapevine.uucp
Reply-To: koreth (Steven Grimm)
Distribution: usa
Organization: Sun Microsystems Federal, Milpitas, CA
Lines: 20