473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Question about Extended ASCII character set, and fstream

Hey all,

Quick question...been bugging me for some time, really. I have a console app, it does some things, and I want to save an array of text to a text file. The text consists of ASCII and extended ascii (codes 0 to 255). I am using ofstream to output, and this is the line doing the actual output:

outfile << screenbuffer[i].Char.AsciiChar;

Note that screenbuffer is an array of type 'CHAR_INFO', quick info of it here:

http://msdn.microsoft.com/library/de...r_info_str.asp

Anyhow, the output, when I open it up in Notepad, shows ASCII characters fine, but nothing from the extended set (the extened set characters are garbled... into other characters.) When I put some extended ASCII chars into notepad (by holding ALT and pressing some numbers), they appear ok. When I try to save the file, it tells me I need to save in Unicode format.

SOOOO, I cannot figure out how to output to a text file in Unicode format from my program. Any ideas?
Thanks in advance!
Andy
Jul 22 '05 #1
1 3746

<no****@all.com> wrote in message news:lq********************@comcast.com...
Hey all,

Quick question...been bugging me for some time, really. I have a console
app, it does some things, and I want to save an array of text to a text
file. The text consists of ASCII and extended ascii (codes 0 to 255). I am
using ofstream to output, and this is the line doing the actual output:

outfile << screenbuffer[i].Char.AsciiChar;

Note that screenbuffer is an array of type 'CHAR_INFO', quick info of it
here:

http://msdn.microsoft.com/library/de...r_info_str.asp

Anyhow, the output, when I open it up in Notepad, shows ASCII characters
fine, but nothing from the extended set (the extened set characters are
garbled... into other characters.) When I put some extended ASCII chars
into notepad (by holding ALT and pressing some numbers), they appear ok.
When I try to save the file, it tells me I need to save in Unicode format.

SOOOO, I cannot figure out how to output to a text file in Unicode format
from my program. Any ideas?

You have two choices:

1. Use wide char streams (std::wofstream)

or

2. Use unformatted output (basic_ostream<...>::write method)

Br/
Catalin
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: bgbauer70 | last post by:
My appologies if this ends up being a duplicate post. For some reason the first post never showed up. I've tried about 300 iterrations of this same ability, and none of them seem to work in...
1
by: Bülent Üstün | last post by:
Hi, im trying to upload somefiles using sockets to a FTP site. But i've some problems with extended ascii characters. When i try "MKD bülent" the created folder is "blent". The directory name is...
6
by: KA Kueh | last post by:
Dear all, I have a requirement to replace the ' character with ASCII character (146) in C# but it seems that when I do the following the conversion is lost. char t = Convert.ToChar(146);...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
3
by: Youssef Mesri | last post by:
I have two files, the first one is an ascii file and the second is a binary one. I want to add the ascii file on the end of the binary file in order to obtain a one binary file: I have done...
4
by: =?Utf-8?B?Um9zaGFuIFIuRA==?= | last post by:
Hi All, I am new to C# programming; I am developing an application for recording audio data using voice modem. I am using HyperTerminal to manually process audio data. The modem when configured...
6
by: Andy Leese | last post by:
Beginner Question: ASCII Symbols I am using Borland C++ and programming under DOS. I wish to display the symbols of the early ASCII character set... For example: cout << char(7); ...
1
by: s123 | last post by:
Hi, while invoking a web service, if in xml request message i wrap the extended ASCII characters with CDATA it is not returning the desired result, while this is not the case if i do not wrap...
13
by: ramif | last post by:
Is there a way to print extended ASCII in C?? I tried to code something, but it only displays strange symbols. here is my code: main() { char chr = 177; //stores the extended ASCII...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.