Questions tagged [widestring]

112 questions
1
vote
1 answer

What is the issue in following conversion from argv[1] to char * string?

I am very new to C and pointers. I am trying to convert command line argument to wchar_t * . But somehow it is not giving proper output. What am I missing? void fun(){ std::setlocale(LC_ALL, "en_US.utf8"); …
1
vote
2 answers

wscanf() behaving differently than scanf() when taking input

I have a simple program which takes user input as a string and output the entered string. The only difference is that I have provided two option to the user, First to input a basic string. Second to input a wide string. The scanf() successfully…
Prateek Joshi
  • 3,929
  • 3
  • 41
  • 51
1
vote
0 answers

Why can't I convert a multibyte string to a wide string? mbsrtowcs fails with EILSEQ even though the mbstring seems valid

Please see this snippet I wrote that is supposed to simply convert a multibyte string (which it gets from stdin) to a wide string. Having read the mbsrtowcs and mbstate_t documentation from cppreference I thought it was valid: #include…
user4385532
1
vote
1 answer

Access Violation when trying to create class with wide string

Im making a code which is supposed to read a debug log, parse the log, and activate a google text-to-speech which will give info about the game that spits it out. The log has UTF-8 encoding, so im using wide strings in the code, the code compiles,…
OptoCloud
  • 57
  • 9
1
vote
1 answer

How to read a "wide" string into a buffer?

The Windows API has functions like GetWindowTextW that read a string into a buffer you provide. How do I provide such a buffer and then read a string from it in Rust? P.S. In contrast to this question Calling the GetUserName WinAPI function with a…
VasiliNovikov
  • 9,681
  • 4
  • 44
  • 62
1
vote
2 answers

How pass word number to widestring?

First of all I am sorry that I cannot better to describe my problem. What I have is Word number 65025 which is 0xFE01 or 11111110 00000001 in binary. And I want to pass the value to wstr Word => 11111110 00000001. I found that using typecast does…
John Boe
  • 3,501
  • 10
  • 37
  • 71
1
vote
1 answer

Should I pass a mutable reference or transfer ownership of a variable in the context of FFI?

I have a program that utilizes a Windows API via a C FFI (via winapi-rs). One of the functions expects a pointer to a pointer to a string as an output parameter. The function will store its result into this string. I'm using a variable of type…
Norbert
  • 735
  • 8
  • 19
1
vote
1 answer

Proper manipulation of wide char/string in C

OS X Yosemite 10.10.5 XCode 7.2 I've been reading and experimenting whole day long, about wide char/string in C and I still can't make it work. I'm trying to read a file composed only by wide characters like the followings: んわらやま (Japanese) I…
Paul
  • 150
  • 1
  • 12
1
vote
3 answers

Opencv functions and wide strings

Opencv functions like cv::imread() take as arguments only strings. So, if I write: cv::Mat image = cv::imread("C:\\folder\\image.jpg"); everything is fine and it will load the image. But, if the path contains wide characters (for example greek…
DimChtz
  • 4,043
  • 2
  • 21
  • 39
1
vote
4 answers

Sending TCHAR buffer with send(sock, wszBuffer, ...)?

I have a wide-character XML message that I need to send over a Win32 socket in C++. TCHAR wszBuffer[1024]; Should I sprintf(szSendBuffer, "%S", wszBuffer) the wide character buffer to a char array before sending it? What is the correct way to send…
Petrus Theron
  • 27,855
  • 36
  • 153
  • 287
1
vote
5 answers

What can cause SysFreeString to hit an Int 3 breakpoint?

I've got some code that worked fine under Delphi 2007 but breaks under D2010. It involves passing in a string, converting it to a PWideChar (specifically, a WideString pointer, not a UnicodeString pointer), doing some processing, and then calling…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
1
vote
1 answer

How to cast wchar_t into int for displaying the code point?

I have a simple function in my program, when I was wanting to mess around with unicode and do stuff with it. In this function, I wished to display the code value of the character the user entered. It SEEMED possible, here's my function: wstring…
John D.
  • 265
  • 4
  • 10
1
vote
1 answer

Convert WideString to PWideChar

I use Nicomsoft OCR library to OCR images in Delphi. It is good for my tasks and it has Delphi unit-wrapper so it's easy to use it in Delphi. However, Delphi debugger shows "Range Error" message when I pass empty string as parameter value to some…
Mulder915
  • 13
  • 1
  • 4
1
vote
2 answers

Error - Perl execution failed. Wide character in syswrite

I have a perl script which runs a bunch of commands redirects both stdin and stderr into a text file. After the scripts finish, I display the contents of the file to a webpage that invoked it, using cgi. At least one of the lines wrote to the file…
James Oravec
  • 19,579
  • 27
  • 94
  • 160
1
vote
0 answers

How to add wide string prefix to C-style string (in C++)?

How do I add the wide string prefix to a C-style string (in C++)? I've seen the L added to literals: L"Hello"; But given: const char cs[] = "Hello"; neither L(cs); nor (L)cs; works. What is the correct way to express it?
CodeBricks
  • 1,771
  • 3
  • 17
  • 37