Home » Community » Newbie corner » Writing hexadecimal to files
Re: Writing hexadecimal to files [message #32521 is a reply to message #32517] |
Mon, 23 May 2011 18:10   |
|
Hi tjerk,
You are doing it almost right The problem is that in Upp::String (unlike std::string) \x00 terminates the string. One possible solution is to use Vector instead: Vector<byte> v;
v.Add('a');
v.Add(0);
v.Add(4);
v.Add('\x00');
v.Add('x');
FileOut f(myfile);
f.Put(v,v.GetCount);
f.Close();
Another, sometimes simpler, approach is to use the binary interface of FileOut, the Put* methods (the same goes for FileIn and Get* for binary reading): FileOut f(myfile);
f.Put('a',1);
f.Put('\x00',3);
f.Put('b',1);
f.Close();
See Stream documentation for details.
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Fri Jul 18 14:36:59 CEST 2025
Total time taken to generate the page: 0.05113 seconds
|