16,004,564 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Nemanja Trifunovic (Top 19 by date)
Nemanja Trifunovic
13-May-11 8:31am
View
Deleted
That's fine - just be aware that it solves a slightly different problem: converting UTF-16 to/from current system code page, which can really be anything. Internaly it uses Windows conversion API.
Nemanja Trifunovic
14-Apr-11 11:43am
View
+5.
Nemanja Trifunovic
12-Apr-11 14:07pm
View
Why does this question have MemoryBarrier tag?
Nemanja Trifunovic
4-Apr-11 22:50pm
View
Deleted
As I repeated several times: this is from ASCII to Unicode. ASCII characters are *always* < 127. Encoding detection is way beyond the scope of this little tip.
Nemanja Trifunovic
30-Mar-11 14:19pm
View
Deleted
The sample could be improved. std::string is guaranteed to store memory in a single block (well, at least in C++ 2011, but all current STL implementations do that anyway) so you can just reserve the string buffer with an appropriate size (which BTW needs to be done via a separate call to WideCharToMultiByte - your sample will work only for ASCII characters) and pass it directly instead of dealing with a temporary array.
Nemanja Trifunovic
30-Mar-11 14:12pm
View
Deleted
Reason for my vote of 5
Nice. However, be aware that your approach is not exactly equivalent to the original. CP_UTF8 means the resulting string will be UTF-8 encoded. CW2A macro converts the string to the system encoding on the user's machine.
Nemanja Trifunovic
30-Mar-11 11:07am
View
Deleted
Well, you said: "but when you are dealing with unicode data this doesn't work fine...". My point is that it works as described - it converts an ASCII string to a UTF-16 Unicode one (on Windows). The tip is not about best practices for developing "world-ready" software.
Nemanja Trifunovic
30-Mar-11 8:42am
View
Deleted
Mital, please check the title of the tip: "ASCII strings to Unicode". Of course it does not work if anything other than ASCII is stored in the source string; the point is that if you know you have only ASCII there is no way to call conversion functions - all you need to do is "widen" existing characters to.
Nemanja Trifunovic
29-Mar-11 13:14pm
View
The question is tagged with C, C++. Your example is in neither of these languages.
Nemanja Trifunovic
29-Mar-11 8:58am
View
Deleted
Yep, very good :)
Nemanja Trifunovic
29-Mar-11 8:56am
View
Deleted
@Gernot: The title of my tip is clear: from ASCII to Unicode. ASCII is a 7 bit encoding and there can't be any characters > 127. If you have some other encoding of course you need to use something like MultiByteToWideChar or iconv.
Nemanja Trifunovic
28-Mar-11 10:26am
View
IMHO, it is an incomplete answer. OP wants to know how to pass a multidimensional array to a function. Passing just a pointer without the size(s) is not enough.
Nemanja Trifunovic
28-Mar-11 10:24am
View
It is not about style here. Because array decays into pointers when passed as function arguments, there is no way to determine the size of the array from within a function. Therefore, either the size needs to be passed as a separate parameter, or array needs to be terminated by some well-known value that the function will recognize.
Nemanja Trifunovic
27-Mar-11 17:06pm
View
It is not a good idea to hardcode the array size within the function. It is better to pass it as another parameter instead.
Nemanja Trifunovic
16-Mar-11 22:22pm
View
In my sample, it is the derived classs that is instantiated and it does not have any virtual functions.
Nemanja Trifunovic
17-Feb-11 10:45am
View
You can distribute the dll's even without the redistributable package - the difference is, depending on the version of VC++ (or even Windows?) you need to supply a manifest file together with the dlls.
Nemanja Trifunovic
27-Dec-10 10:34am
View
Microsoft replaced the Intellisense C++ compiler completely and the new one was not ready for C++/CLI in time for VS2010.
Nemanja Trifunovic
30-Sep-10 11:30am
View
Deleted
It would be interesting to add that early in C++ days there was no delete[] version, and plain delete was supposed to be used to clean up both after new and new[]. Of course, one should not assume that it would be OK to do such a thing nowdays.
Nemanja Trifunovic
25-May-10 11:58am
View
This is a correct answer. References are in practice implemented as pointers, but that is just an implementation detail. A reference is really an alias.
As I stated in my answer
Show More