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
Joined
Oct 12, 2004
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
244
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++?
 

sshahid47

Advanced Member level 4
Joined
Nov 5, 2004
Messages
101
Helped
15
Reputation
30
Reaction score
2
Trophy points
1,298
Activity points
974
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.
 

C++

Junior Member level 3
Joined
Oct 12, 2004
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
244
It's a string containing unicode characters
 

sshahid47

Advanced Member level 4
Joined
Nov 5, 2004
Messages
101
Helped
15
Reputation
30
Reaction score
2
Trophy points
1,298
Activity points
974
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

sshahid47

Advanced Member level 4
Joined
Nov 5, 2004
Messages
101
Helped
15
Reputation
30
Reaction score
2
Trophy points
1,298
Activity points
974
hi,
notice that i am using the big "S" for wprintf statment.
 

    C++

    Points: 2
    Helpful Answer Positive Rating

C++

Junior Member level 3
Joined
Oct 12, 2004
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
244
what header is WCHAR in? I included everything I thought might work, but, well, it didn't
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
C++ has no such thing as WCHAR. Try wchar_t.
 

    C++

    Points: 2
    Helpful Answer Positive Rating

sshahid47

Advanced Member level 4
Joined
Nov 5, 2004
Messages
101
Helped
15
Reputation
30
Reaction score
2
Trophy points
1,298
Activity points
974
Hi,
WCHAR is defined in WinNT.h
hence include <windows.h>

enjoy.
 

zeeallana

Newbie level 1
Joined
Aug 27, 2005
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
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);
}
 

vikkyse

Newbie level 5
Joined
Sep 30, 2004
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
74
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top