Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » va_list problem
va_list problem [message #25820] Sat, 13 March 2010 23:52 Go to next message
amando1957 is currently offline  amando1957
Messages: 57
Registered: November 2007
Location: Wien/Vienna/Viden
Member
Hello folks

I'm trying to write a func format(), which should replace sprintf(), using va_list etc. At my machine it runs, but it's printing only trash. Could someone have a look please.

Here ist the code:
http://members.aon.at/amando1957/c++_forum/textutil.htm

The second func sum() there is running fine.

Martin
Re: va_list problem [message #25821 is a reply to message #25820] Sun, 14 March 2010 00:20 Go to previous messageGo to next message
amando1957 is currently offline  amando1957
Messages: 57
Registered: November 2007
Location: Wien/Vienna/Viden
Member

Maybe that's why I'm using sprintf() also? That means, two va_lists are running at the same time boxed. Could that do a harm maybe?

Martin
Re: va_list problem [message #25829 is a reply to message #25821] Sun, 14 March 2010 16:13 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Amando

A lot easier. Just replace "count" with "f" in va_start(li, count);

Nothing else Smile


Best regards
IƱaki
Re: va_list problem [message #25853 is a reply to message #25829] Mon, 15 March 2010 22:44 Go to previous message
amando1957 is currently offline  amando1957
Messages: 57
Registered: November 2007
Location: Wien/Vienna/Viden
Member
Hi Koldo

Good idea. Now it's printing all the args, only the first one is missing, %i (which is 4), though I get the report:

typefound = 'i'.


alike for the other three args. The output at my machine is now:

==>  args wrapped, double == 0.456124f


Thanks for the hint.
Martin
Previous Topic: global Object and static std::map --> Crash
Next Topic: Detect when a key is pressed!
Goto Forum:
  


Current Time: Fri Mar 29 10:58:54 CET 2024

Total time taken to generate the page: 0.02481 seconds