Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C++ - International Characters

Status
Not open for further replies.

C++

Junior Member level 3
Junior Member level 3
Joined
Oct 12, 2004
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
243
I've already found this on the net
Code:
ostream& operator<<(ostream & os, char* szSource) {
   TCHAR szDestination[260] = "";
   CharToOem(szSource, szDestination);
   printf(szDestination);
   return os;
}

but it doesn't work . . . so is there any other way to print international characters in console using C++?
 

hi,
your problem has not been stated properly and the code snippet u have is confusing,
i assume u have a string of unicode charaters, since unicode chars support international characters.or do u have a string of MBCS which has international characters, depending on this the solution may vary.
 

It's a string containing unicode characters
 

hi,
i am pasting a code snippet i used to display unicode chars,

int main(int argc, char* argv[])
{

WCHAR data[10]={0};
for(int i=0;i<=8;i++)
data=310+i;

wprintf(L"%S",data);
return 0;
}


this is a console application and compiled with Unicode option.
 

    C++

    Points: 2
    Helpful Answer Positive Rating
hi,
notice that i am using the big "S" for wprintf statment.
 

    C++

    Points: 2
    Helpful Answer Positive Rating
what header is WCHAR in? I included everything I thought might work, but, well, it didn't
 

C++ has no such thing as WCHAR. Try wchar_t.
 

    C++

    Points: 2
    Helpful Answer Positive Rating
Hi,
WCHAR is defined in WinNT.h
hence include <windows.h>

enjoy.
 

Sir, My objective is to copy a character(Arabic letter) from one MS OFFICE WORD( .doc) file to another MS OFFICE WORD( .doc) file. The pasted programm work perfectly on English (letter) character, Sir I am confuse how to copy a (unicode or) arbic character? What is the syntax of C++ to copy an unicode and which version of C++? Sir I am using Turbo C++ version 3.0

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void main (void)
{
clrscr();

FILE *fa,*fb;
int ch;

fa=fopen("Read.doc","rb");
fb=fopen("Write.doc","wb");

ch=getc(fa);
putc(ch,fb);

fclose(fa);
fclose(fb);
}
 

the code posted above will not work as it only recognises single byte char and not DBCS or MBCS
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top