string problem in VC++ Express
-
- Earned a small fee
- Posts: 18
- Joined: Mon Mar 27, 2006 9:22 pm
string problem in VC++ Express
I can't compile the following string
_("This is first line\n"
"This is second line")
under VC++ Express.
How to change it?
_("This is first line\n"
"This is second line")
under VC++ Express.
How to change it?
Re: string problem in VC++ Express
try:
_("This is first line\n" \
"This is second line")
or
_("This is first line\n \
This is second line")
_("This is first line\n" \
"This is second line")
or
_("This is first line\n \
This is second line")
-
- Earned a small fee
- Posts: 18
- Joined: Mon Mar 27, 2006 9:22 pm
It is unicode problem
I forget to say it passed under non-unicode and fail under unicode.
I think "\"
is not the solution.
I think "\"
is not the solution.
Hi
the code posted abow is working .. i tested using Visual Studio .net Framework 2003
I tested like this
and its getting compiled properly .. i guess its problem with something else can u tell what exactly u r doing there and can u post some of the code
the code abow shud not create any compilation error i guess
the code posted abow is working .. i tested using Visual Studio .net Framework 2003
I tested like this
Code: Select all
wxString test_string = _("This is first line\n"
"This is second line");
the code abow shud not create any compilation error i guess
-
- Super wx Problem Solver
- Posts: 317
- Joined: Sat Mar 18, 2006 10:41 am
- Location: Ustek, Bohemia
Code: Select all
str = wxT("first line\n"
"second line");
Code: Select all
str = L"first line\n"
"second line";
Code: Select all
str = wxT("first line\n")
wxT("second line");
Code: Select all
str = wxT("\
first line\n\
second line");
-
- Earned a small fee
- Posts: 18
- Joined: Mon Mar 27, 2006 9:22 pm
micros,
Thank you for your correct reply.
So I summarize the right solution is
1. wxString str = wxT("first line\n")
wxT("second line");
2. wxString str = wxT("first line\n\
second line\n");
I think solution 1 is more elegant.
BTW, could you explain what is the difference between
"wxT()" and "_T()"?
Thank you for your correct reply.
So I summarize the right solution is
1. wxString str = wxT("first line\n")
wxT("second line");
2. wxString str = wxT("first line\n\
second line\n");
I think solution 1 is more elegant.
BTW, could you explain what is the difference between
"wxT()" and "_T()"?
-
- Super wx Problem Solver
- Posts: 317
- Joined: Sat Mar 18, 2006 10:41 am
- Location: Ustek, Bohemia
I also use the 1st form, mainly because the second can't be indented properly. I only wanted the post to be complete.
No difference between wxT() and _T(). It's only that MSVC users are used to _T() from < tchar.h>. I also was. But since I switched to wxWidgets, I prefer wxT(). Even though it's longer, I like it more. Another silly argument is that identifiers beginning with two underscores or an underscore and a capital letter (i.e. matching /^_[_A-Z]/) are reserved in the C++ standard. Of course it's very unlikely _T will be used for anything else in any future library/compiler, because it's current purpose and use are so widespread.
No difference between wxT() and _T(). It's only that MSVC users are used to _T() from < tchar.h>. I also was. But since I switched to wxWidgets, I prefer wxT(). Even though it's longer, I like it more. Another silly argument is that identifiers beginning with two underscores or an underscore and a capital letter (i.e. matching /^_[_A-Z]/) are reserved in the C++ standard. Of course it's very unlikely _T will be used for anything else in any future library/compiler, because it's current purpose and use are so widespread.