473,797 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

char 8bit wide or 7bit wide in c++?

Hi,

Have a book that says a char in c++ is 8bit wide. But i remember reading
that C++ uses ANSI character set which uses 7bit per character. Who is
right?
WD
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 24/07/2003
Jul 19 '05 #1
2 3106

"Web Developer" <no****@hotmail .com> wrote in message
news:3f******** **@news.iprimus .com.au...
Hi,

Have a book that says a char in c++ is 8bit wide. But i remember reading
that C++ uses ANSI character set which uses 7bit per character. Who is
right?


Neither. In fact every statement about C++ above is wrong. Here's the truth.

In C++ a byte must be at least 8 bits. A char must be a single byte.

C++ does not use the ANSI character set (maybe you mean ASCII?), it might,
but it does not have to, it could use a completely different character set.

Even if C++ did use a seven bit character set, then it would do so in a
eight bit character (probably) and just ignore the extra bit.

john
Jul 19 '05 #2

"John Harrison" <jo************ *@hotmail.com> wrote in message
news:bg******** ****@ID-196037.news.uni-berlin.de...

"Web Developer" <no****@hotmail .com> wrote in message
news:3f******** **@news.iprimus .com.au...
Hi,

Have a book that says a char in c++ is 8bit wide. But i remember reading
that C++ uses ANSI character set which uses 7bit per character. Who is
right?

Neither. In fact every statement about C++ above is wrong. Here's the

truth.


What's the book BTW?

john
Jul 19 '05 #3

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

Similar topics

7
1758
by: copx | last post by:
For some reason Python (on Windows) doesn't use the system's default character set and that's a serious problem for me. I need to process German textfiles (containing umlauts and other > 7bit ASCII characters) and generally work with strings which need to be processed using the local encoding (I need to display the text using a Tk-based GUI for example). The only solution I managed to find was converting between unicode and latin-1 all the...
0
1581
by: marko | last post by:
How to convert 8bit numbers to 7bit numbers? Thanks, Marko
2
3425
by: Peter Nilsson | last post by:
In a post regarding toupper(), Richard Heathfield once asked me to think about what the conversion of a char to unsigned char would mean, and whether it was sensible to actually do so. And pete has raised a doubt in my mind on the same issue. Either through ignorance or incompetence, I've been unable to resolve some issues. 6.4.4.4p6 states...
15
2035
by: T Koster | last post by:
Hi group, I'm having some difficulty figuring out the most portable way to read 24 bits from a file. This is related to a Base-64 encoding. The file is opened in binary mode, and I'm using fread to read three bytes from it. The question is though, where should fread put this? I have considered two alternatives, but neither seem like a good idea: In most cases, the width of a char is 8 bits, so an array of 3 chars
7
53555
by: d.kaufmann | last post by:
i have this part of code: typedef enum { OW_SEARCH_ROM = 0xF0, OW_MATCH_ROM = 0x55, OW_CONDITIONAL_SEARCH_ROM = 0xEC, OW_HANDLE_SELECT = 0x0F } ow_command_t;
7
2664
by: Lance | last post by:
Is there any way to create an import alias that applies to the entire project? For example, lets say that I want "VB" to represent Microsoft.VisualBasic throughout my entire project. Is there any way to do this without adding "Imports VB = Microsoft.VisualBasic" to the top of each file in the project? Thanks.
2
1461
by: Mark Olbert | last post by:
I want to bind a series of ObjectDataSource instances to an application-wide business object which caches the results of a database query. I'm confused about where/how to cache the results (it's a simple query, BTW, so I'm using a DataReader, not a DataTable). The business object has no knowledge of the application, and hence of the Cache, which is where I would normally put this kind of thing (actually, I used to put this stuff in...
8
2231
by: poodles | last post by:
I'm trying to find out the ranges of different data types through direct computation........this is what I did....... Code: #include <stdio.h> main() { char ch; signed short sh;
3
20745
by: diadomraz | last post by:
Hi, This is a question about declaring a signed 8bit numeric type in C++ that prints like a numeric variable and not like a char variable. I would like to declare a type with name 'byte' which represents 8bit numeric values. Of course C++ has char with the right size. So I tried ------ typedef char byte; ------ This is fine, until I tried --------- byte b = 1; cout << b;
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10468
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.