C/C++ Windows API

Moderators: Lundin
Number of threads: 450
Number of posts: 1225

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Simple Work with UNICODE Posted by AsmGuru62 on 28 Mar 2010 at 5:04 AM
: Hello everybody,
: can anyone help me? :S
:
: how can I get only one character from
: WCHAR *str = L"string";
: for example only "r", when I'm typing this
: MessageBox(NULL,&str[3],NULL,NULL);
: it gets "ring" and not "r"
:
: please help me ...
:

Since message box function takes a string as parameter - you need to CREATE a second string with only one character - one you need. Also, character indexes begin with 0, so 'r' will be addressed as str[2] and not str[3].

WCHAR *str = L"string";
WCHAR buf [2]; // New string with room for ONLY one character

...

buf [0] = str [2]; // Move 'r' as first character of new string
buf [1] = 0;       // Terminate new string with null as C lang. needs
MessageBox (0, buf, 0, 0); // Now you will see only one character
Thread Tree
newtron Simple Work with UNICODE on 10 Mar 2010 at 2:29 PM
untio Re: Simple Work with UNICODE on 27 Mar 2010 at 1:25 PM
AsmGuru62 Re: Simple Work with UNICODE on 28 Mar 2010 at 5:04 AM
untio Re: Simple Work with UNICODE on 28 Mar 2010 at 9:10 AM
AsmGuru62 Re: Simple Work with UNICODE on 31 Mar 2010 at 4:52 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.