Home » U++ Library support » U++ Core » Stream::Putf 
	
		
		
			| Stream::Putf [message #6900] | 
			Mon, 04 December 2006 00:29   | 
		 
		
			
				
				
				
					
						  
						g00fy
						 Messages: 15 Registered: December 2006  Location: Mechelen, Belgium, Europe
						
					 | 
					Promising Member  | 
					 | 
		 
		 
	 | 
 
	
		#include <CtrlLib/CtrlLib.h>
#include <ide/Common/Common.h>
#include <Core/Core.h>
void write_out( FileOut& out, const XmlNode& xml, int ident )
{
	switch( xml.GetType() )
	{
	case XML_TEXT:
		out << String(" ", ident) << "Text: " << xml.GetText() << "\n";
		break;
	case XML_TAG:
		out << String(" ", ident) << "Tag: " << xml.GetTag() << "\n";
		break;
	case XML_DOC:
		out << String(" ", ident) << "Doc:\n";
		break;
	default:
		out << String(" ", ident) << "**UNDEFINED TAG**\n";
		break;
	}
	
	for ( int i = 0, total = xml.GetCount(); i < total; i++ )
	{
		write_out(out, xml[i], ident + 2);
	}
}
GUI_APP_MAIN
{
	Package p;
	
	p.Load("C:\\Upp\\uppsrc\\ide\\Common\\Common.upp");
	
	FileIn in("c:\\tmp\\common.xml");
	char * data = (char*)malloc(in.GetSize());
	in.GetAll(data,in.GetSize());
	XmlNode xml = ParseXML(data);
	
	FileOut out("c:\\tst.dat");
	write_out(out, xml, 2);
	
	free(data);
} 
 
With this code I get a lot of nasty buggers in the written 'tst.dat' (meaning: if String("abc"), then "abc\0" is written). 
 
 
Greetz, 
Steven
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 04:29:58 CET 2025 
 Total time taken to generate the page: 0.05135 seconds 
 |