delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/16/21:46:23

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sprintf() string length?
Date: Thu, 16 Oct 1997 18:34:27 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 23
Message-ID: <34465E33.719A@cs.com>
References: <3 DOT 0 DOT 16 DOT 19971014214406 DOT 2c573b3e AT hem1 DOT passagen DOT se> <3445D623 DOT 605E AT ukc DOT ac DOT uk> <6256nc$jtt$1 AT star DOT cs DOT vu DOT nl>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp243.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ruiter de M wrote:
> 
> Jonathan Foster (jgf1 AT ukc DOT ac DOT uk) wrote:
> : The "fprintf" command will return the number of characters output,
> 
> I thought it returns the number of correctly parsed arguments after
> the format string. But my Solaris man pages say you are right.

Close.  scanf() returns the number of arguments it successfully read. 
You just got it backwards.  :)

My idea for a solution to the problem would be to create a buffer large
enough to store at least part of the long string and use sprintf() one
chunk at a time.  I can't, offhand, imagine any situation where this
would be necessary, though...

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Money is truthful.  If a man speaks |
|       aka Fighteer I       | of his honor, make him pay cash."    |
|   mailto:fighteer AT cs DOT com   |                                      |
| http://www.cs.com/fighteer |               - Lazarus Long         |
---------------------------------------------------------------------

- Raw text -


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