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 » U++ Library support » U++ Core » Format Issues - Dynamic width and alignment
Format Issues - Dynamic width and alignment [message #18866] Wed, 29 October 2008 17:48 Go to previous message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Hey, I'm trying to use alignment and dynamic widths based on the size of strings with the Format function.
Ex:
Cout() << Format("|%20=s|\n", "test"); 		// Works as expected
Cout() << Format("|%*=s|\n", 20, "test"); 	// Seg Fault Heap Corrupted


How can I use * to insert the width I want dynamically?

Update:
Found a small workaround...
String fm("");
int width = 20;
fm.Cat() << "%" << width << "=s";
Cout() << Format(fm, "test");


Would still like to know if it is possible with just 1 formatting line though.

[Updated on: Wed, 29 October 2008 18:05]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Compile error in Stream.cpp with GCC (Ubuntu 8.10)
Next Topic: Report serialization
Goto Forum:
  


Current Time: Mon Apr 29 11:56:29 CEST 2024

Total time taken to generate the page: 0.02926 seconds