Questions tagged [widestring]
112 questions
0
votes
1 answer
How to print int to std::wcerr?
How do I write the output operator<< if my object needs to print a std::wstring as well as ints, etc?
#include
struct Foo {
int i;
std::wstring wstr;
};
std::ostream& operator<<(std::ostream& out, Foo const& foo) {
out << foo.i <<…

Frank
- 64,140
- 93
- 237
- 324
-1
votes
1 answer
Converting from int to wide character string using sprintf_s
My goal is to convert an int to a wide character string and prefix it with another wide string. My current solution is this:
#define bufsize 20
char buffer[bufsize];
sprintf_s(buffer,bufsize,"%s%d", "my prefix", 42);
wchar_t…

mbl
- 805
- 11
- 18
-1
votes
1 answer
cannot convert from 'const char *' to 'LPCTSTR'
I'm trying to convert string to 'LPCTSTR', but, i got following error.
Error :
cannot convert from 'const char *' to 'LPCTSTR'
code:
std::string str = "helloworld";
LPCTSTR lp = str.c_str();
Also, tried :
LPCTSTR lp = (LPCTSTR)str.c_str();
But,…

Jayesh
- 4,755
- 9
- 32
- 62
-1
votes
1 answer
va_args breaks wide string functions (swprintf) in XCode
In Xcode only (visual studio is fine), I am seeing swprintf break if you attempt to put it in a wrapper function using va_args.
Simplified example:
void test( wchar_t *a_buffer, int a_buffer_size, const wchar_t* a_format, ...)
{
va_list args;
…

William S
- 54
- 4
-1
votes
1 answer
The size parameter from function
I see that a lot of functions need you to set a size for the string which is the output.
GetComputerNameW needs:
WCHAR wStrName[16U];
DWORD uSize = 16U;
GetComputerNameW(wStrName, &uSize);
RegSetValueExW needs:
WCHAR…
-2
votes
5 answers
Delphi - Store WideStrings inside a program
In the past I used INI-Files to store unicode text, but now I need to store unicode text in the executable. How can I achieve this?
I want to store these letters:
āčēūīšķļņž

Little Helper
- 2,419
- 9
- 37
- 67
-3
votes
1 answer
ansi string to wide string without system api
I'm looking for a way to convert ANSI string to wide string, I need to do this in CUDA CPU code, so I cannot use system API like MultiByteToWideChar. I googled a lot but found nothing about implementing this from scratch.
I downloaded the source…

aj3423
- 2,003
- 3
- 32
- 70