|
What is the type of playerLst ?
What are you trying to do here:
irr::core::stringw(playerLst[i]).c_str()
Why not pass the string directly instead of constructing a temporary string ?
T.RATHA KRISHNAN wrote: Program Crashes.
What is the exact error message ? Did you try debugging to inspect the problem more in details ? You should really start to learn how to use your debugger, this is much much more efficient than asking questions on a forum.
|
|
|
|
|
playerLst is of type irr::core::stringc . Sqlite Query returns only a stringc . So I've used a stringc variable. But setText method expects a const wchar_t* . As I already said,
I've to iterate this playerLst array and set the each element as text to corresponding button in an array of buttons. How to do?
|
|
|
|
|
You ae mixing single-byte character strings and multi-byte character strings. You can't just mix them the way you are doing. I really suggest you take the time to understand the string encoding. See for instance this article[^].
|
|
|
|
|
T.RATHA KRISHNAN wrote: Only the first letter of the string value is assigned to the formal parameter.
How are you verifying this?
T.RATHA KRISHNAN wrote: cout<<query.c_str()<<endl;< blockquote="">
Should you be using wcout here?
T.RATHA KRISHNAN wrote: printf("%s\n",query.c_str());
Have you tried using a capital 'S' in the format string?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
you are mixing wchar with char size strings. You need conversion NOT cast.
c_str() should do the job
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Don't use printf. The interface to printf isn't type checked so the compiler has no idea that you're passing complete rubbish to it. What's happening is...
- your code sticks a pointer to a lump of wide characters on the stack
- printf looks at it's format string and sees that you want the first argument on the stack interpreted as a lump of ordinary characters terminated by a zero
- it starts reading your wide character array, sees the first character is non-zero but, as it's reading the memory byte by byte it sees the high byte of the first character as the string terminator. It prints one character
- printf stops processing having done everything you told it to do
So what can you do about it?
The first thing is stop using printf. Printf is a C function - while it's bundled in the C++ library it's pretty useless. Use streams, they're the equivalent C++ mechanism. AND you don't have to convert your function arguments either. Instead of trying to use:
printf( "%s\n", str.c_str() );
you can use:
std::wcout << str << std::endl;
Look ma, no conversions! Same number of function calls and the compiler can probably optimise it a lot easier. You also get type safety - if you try and use a stream with an object type it doesn't understand the compiler will tell you.
Cheers,
Ash
|
|
|
|
|
Aescleal wrote: - your code sticks a pointer to a lump of wide characters on the stack
And even this is just a lucky coincident. It could just as well be other things, like an integer describing the length of the string, or whatever's first in the passed object. Interpreting that as a pointer to anything will not make anyone happy.
|
|
|
|
|
Well he did .c_str() on the string so he will repeatably get a pointer to a lump of wide characters. Had he used the correct format string he'd probably have been safe. Okay, maybe not safe as he would have had no idea why it was working looking at the rest of his posts on here.
Cheers,
Ash
|
|
|
|
|
Well, here
stringw country;
...
printf("Selected Country%s\n", country);
he got 'lucky'.
|
|
|
|
|
Cool, I missed that one. I was too busy nashing me teeth at the others I could see.
Cheers,
Ash
|
|
|
|
|
Hi Friends,
I am going to learn MFC Smart Device technology, i don't have a material please help me..
Thanks and Regards,
D.Manivelan
|
|
|
|
|
Member 4482742 wrote: I am going to learn MFC Smart Device technology, i don't have a material please help me.
Well you need to learn to use the smart tools like this[^].
It's time for a new signature.
|
|
|
|
|
I have drawn an image over a picture control. I want to draw transparent mask (grey color) over the image.
How can I do that?
|
|
|
|
|
|
The project compiles correctly in VS2008, but not with 2010.
The error is
1>c:\program files\microsoft visual studio 10.0\vc\include\intrin.h(1065): error C2143: syntax error : missing ')' before 'constant'
1>c:\program files\microsoft visual studio 10.0\vc\include\intrin.h(1065): error C2143: syntax error : missing ';' before 'constant'
1>c:\program files\microsoft visual studio 10.0\vc\include\intrin.h(1065): error C2059: syntax error : ')'
pointing to
__MACHINEI(void __cpuid(int a[4], int b))
__MACHINEI(void __cpuidex(int a[4], int b, int c)) <== this is the line that's giving me compile error
__MACHINEI(unsigned __int64 __readpmc(unsigned long a))
Any ideas?
|
|
|
|
|
Simply including intrin.h goes no error in VS2010.
Just tried that in an MFC SDI application.
|
|
|
|
|
I didn't include 'intrin.h' in my code.
|
|
|
|
|
install the new SDK.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi all,
I am trying to send and recieve information from my Human Interface Device. I have Installed WDK also, but my problem is my application is still giving error
Cannot open include file: 'hidsdi.h': No such file or directory
Can anybody help me in this...
|
|
|
|
|
Add the folder that contains the header file to Project -> Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories .
|
|
|
|
|
Add the folder containing such file to the VC++ Directories list:
On Visual Studio , select then Tools->Options menu item, then, on the newly appeared window, choose Projects and Solutions->VC++ Directories and finally add the proper folder (this works, at least on VS 2005).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i am using Visual Studio 2008, i have tried your method but still same error is coming
|
|
|
|
|
I forgot to mention you have to first select Include files in the Show directories for: combo box and then add the proper folder.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
It's likely that 'Mystical Powers' own your PC, now.
On the Serious Side of the Moon:
- Check very well if the actual file name matches the file name the compiler complains about.
- Check very well if the folder you entered in VC++ (Include) Directories matches with the one inside your hard disk.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Tuesday, July 6, 2010 4:33 AM
|
|
|
|