🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2792

Re: Please help: Using args to obj func

#2792
From: Vladimir Alexiev
Date: Thu, 19 Oct 1995 03:17
12 lines
1124 bytes
In article <460oe9$5a9@news.xmission.com> dev@xmission.com (dev) writes:

> MyClass::MakeAString ( char *fmt, char *str, int i, long l );
> {
>   char tmpstr[200];
>   sprintf( tmpstr, "%s %d", str, i );  // str shows up ok, %d shows bogus val

Looks ok to me... The only thing is, don't try to return this tmpstr
because it will go out of scope when the function returns. If you need to
return it, make it a "static char [200]".

Sorry, can't help.
Technical Details
Message-ID: <omhh1617t0.fsf@tees.cs.ualberta.ca>
Path: arc1-ca.pugleaf.net!rover.ucs.ualberta.ca!alberta!usenet
References: <45pr3o$43s@news.xmission.com> <omzqf01pxk.fsf@tees.cs.ualberta.ca> <460oe9$5a9@news.xmission.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!rover.ucs.ualberta.ca!alberta!usenet
From: Vladimir Alexiev <vladimir@cs.ualberta.ca>
Newsgroups: comp.os.ms-windows.programmer.misc,comp.lang.c++
Subject: Re: Please help: Using args to obj func
Date: 18 Oct 1995 21:17:15 -0600
Organization: University of Alberta, Computing Science
Sender: vladimir@tees.cs.ualberta.ca
Message-ID: <omhh1617t0.fsf@tees.cs.ualberta.ca>
References: <45pr3o$43s@news.xmission.com> <omzqf01pxk.fsf@tees.cs.ualberta.ca>
 <460oe9$5a9@news.xmission.com>
NNTP-Posting-Host: tees.cs.ualberta.ca
In-reply-to: dev@xmission.com's message of 17 Oct 1995 17:16:57 GMT
To: dev@xmission.com (dev)
X-Newsreader: Gnus v5.0