delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/10/18:23:42

From: Hans-Bernhard Broeker <broeker AT acp3bf DOT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Question of fprintf...
Date: 10 Mar 2000 15:48:57 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 28
Message-ID: <8ab5h9$fea$1@nets3.rz.RWTH-Aachen.DE>
References: <38C88020 DOT 19C85510 AT ou DOT edu>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 952703337 15818 137.226.32.75 (10 Mar 2000 15:48:57 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 10 Mar 2000 15:48:57 GMT
User-Agent: tin/1.4-19991113 ("No Labels") (UNIX) (Linux/2.0.0 (i586))
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

David Cleaver <davidis AT ou DOT edu> wrote:
> Hello all,

> I'm sorry for posting this seemingly-newbie-ish question here, but I
> can't really find any documentation on what I'm looking for, and
> what I do find hasn't worked so far.
[...]

> Here, cotnum is from a library I'm using which prints a number
> followed by a new-line character.  Unfortunately, I want the
> following string in the fprintf to be on the same line as the number
> that was just printed.  So, my question is, how do I print the
> "backspace character" (ie, '\0x8')?  

That's the wrong question to be asking. Outputting a backspace
character will not (at least not reliably) erase that newline from the
output. If you really want to get rid of that \n, even though it
already sits in the file, your only choice is to re-open the file in
write/append mode, truncate it to one character less than its original
length, and re-open it again for writing.

In the light of that, I'd strongly suggest forgetting about the whole
plan, unless there's strict necessity to do it (order from your boss,
or something).

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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