The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script or piece of code where the data returned by a stored procedure you are writing enigma_83 Shell Programming and Scripting 3 04-25-2008 03:44 AM
help for a perl script - writing to a data file meghana Shell Programming and Scripting 2 02-04-2008 02:05 PM
Using loop reading a file,retrieving data from data base. Sonu4lov Shell Programming and Scripting 1 01-19-2007 12:38 AM
help for writing shell script to export table data sankarg Shell Programming and Scripting 3 10-18-2006 03:01 AM
Writing data onto new lines based on terminator thanuman UNIX for Dummies Questions & Answers 1 02-23-2005 03:00 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-02-2004
Registered User
 

Join Date: Dec 2001
Location: Dublin
Posts: 44
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
Reply With Quote
Forum Sponsor
  #2  
Old 03-03-2004
Registered User
 

Join Date: Dec 2001
Location: Dublin
Posts: 44
I found that you can use the WCHAR with the setfill() manipultor, hence:
wcout<<setfill<WCHAR>(' ')<<setw(42)

will compile and work fine.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0