delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/02/15:13:14

Xref: news-dnh.mv.net comp.os.msdos.djgpp:3001
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!EU.net!sun4nl!phcoms4.seri.philips.nl!newssvr!kunst
From: kunst AT natlab DOT research DOT philips DOT com (Pieter Kunst)
Subject: Re: CR/LF pairs... NO NO NO!
Sender: news AT natlab DOT research DOT philips DOT com (USENET News System)
Organization: Philips Research Laboratories, Eindhoven, The Netherlands
References: <47946c$9al AT woodstock DOT socs DOT uts DOT EDU DOT AU>
Date: Thu, 2 Nov 1995 16:05:15 GMT
Lines: 24
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <47946c$9al AT woodstock DOT socs DOT uts DOT EDU DOT AU> jkmarsha AT socs DOT uts DOT edu DOT au (Justen Keven Marshall) writes:
>
>Hi
>  I am at my wits end trying to print a line-feed
>  without a carriage return. (Or the other way around.)
>  What happens is that when I try to print char(10) in
>  a file, with printf redirected, fprintf, cout, putchar,
>  fputchar, or whatever, it puts BOTH not just one.
>  I need only one, since I want to put the ascii char 10
>  in the file. I'm using MS-Dos 7.0 (Win95) but it does
>  it with 6.22 as well. Is it the fault of DJGPP, GO32,
>  or something I'm doing? I tried the same thing in Turbo
>  Pascal (the only other language I have) and it didn't
>  do it, so I suspect it is something about C or DJ itself.
>  Thanks for your help...

Open your output file for *binary* output:

   FILE *fp = fopen("myfile.out", "wb");
                                   ^^^
This 'b' (binary) will do the trick.

Pieter.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019