Writing both 8-bit and 16-bit data to a file


 
Thread Tools Search this Thread
Top Forums Programming Writing both 8-bit and 16-bit data to a file
# 1  
Old 03-02-2004
Writing both 8-bit and 16-bit data to a file

I'm writing both 8-bit and wide 16-bit data to the screen and an output file. I have no problems with writing out to the screen - for example:
cout<<8-bit data;
wcout<<16-bit data;

Similarly, I have used ofstream for 8-bit and wofstream for 16-bit, for example:
ofstream out;
wofstream wout;
out<<8-bit data;
wout<<16-bit data;

into the same output file (declared in the ofstream and wofstream constructors).

I find two problems with this method:
1. I still get a mix of correct data and ints (from the 16-bit data)
2. I cannot use manipulator functions such as setw and setfill with the wide 16-bit wcout and wout commands.

Has anyone experienced this problem? Is there a better way of doing this (ie writing both 8-bit and 16-bit data to one file).
Thanks
Smilie
# 2  
Old 03-03-2004
I found that you can use the WCHAR with the setfill() manipultor, hence:
wcout<<setfill<WCHAR>(' ')<<setw(42)

will compile and work fine.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies

2. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

3. UNIX for Advanced & Expert Users

migrating unix mp-ras 32 bit to linux suse 64 bit

Hi. I need to migrate the whole unix environment from a Unix mp-ras 32 bit to a Linux Suse 64 bit. 1) can i use cpio to copy the data? 2) can i just copy the users from unix to linux or do i have to create them by hand 3) are there any other concerns i should worry about? thanx (1 Reply)
Discussion started by: mrodrig
1 Replies

4. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies
Login or Register to Ask a Question