delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/22/15:31:34

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <265000-220034222193133379@M2W046.mail2web.com>
X-Priority: 3
Reply-To: lhall AT rfk DOT com
X-Originating-IP: 209.113.174.244
From: "lhall AT pop DOT ma DOT ultranet DOT com" <lhall AT pop DOT ma DOT ultranet DOT com>
To: alexvn AT connect DOT to, cygwin AT cygwin DOT com, gcc-help AT gcc DOT gnu DOT org
Subject: RE: Problem with wchar_t
Date: Tue, 22 Apr 2003 15:31:33 -0400
MIME-Version: 1.0
X-OriginalArrivalTime: 22 Apr 2003 19:31:22.0495 (UTC) FILETIME=[C1A728F0:01C30905]
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h3MJVY205633

wchar_t is not a char.  It is an unsigned short.

Larry

Original Message:
-----------------
From: Alex Vinokur alexvn AT connect DOT to
Date: Tue, 22 Apr 2003 21:19:07 +0200
To: cygwin AT cygwin DOT com, gcc-help AT gcc DOT gnu DOT org
Subject: Problem with wchar_t




===================
Windows 2000
CYGWIN_NT-5.0
GNU gcc/++ 2.95.3-5
===================

wchar_t wch1 = 65;

Why does 'cout << wch1' print '65' (but not 'A') ?

====== C++ code : BEGIN ======
// File main.cpp
#include <wchar.h>
#include <iostream>
using namespace std;

int main ()
{
wchar_t wch1;
char ch1;

  wch1 = 65;
  ch1  = 65;

  cout << wch1 << endl;
  cout << wchar_t (wch1) << endl;
  cout << ch1 << endl;

  return 0;
}

====== C++ code : END ========


====== Compiling & Running : BEGIN ======

% g++ main.cpp

% a.exe

65
65
A

====== Compiling & Running : END ========


   =================================
   Alex Vinokur
     mailto:alexvn AT connect DOT to
     http://www.simtel.net/pub/oth/19088.html
   =================================








--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019