LPTSTR for int (C ++)

I pass a few numeric arguments when creating a process (in VC ++)

I am fixated on converting LPTSTR to int.

Thanks in advance.

+3
source share
5 answers

LPTSTR is just a long pointer to a char or wide-char string.

Use _ttoior _tstoito convert the agnostic character width attribute.

Also see

+12
source

Gack! What exactly are you trying to do? Is your problem on the side of the parent process (which causes CreateProcess()) or on the side of the child process?

, CreateProcess(). , ( lpCommandLine CreateProcess), , , 2nd.

, ( , , ), - . - . ( ), .

lpCommandLine , , .

+2

atoi() ( , ), .

+1

- _tcstol, _ttoi, , . :

int result = atoi("0");
result = atoi("foo");

0, .

+1

LPTSTR , int, , , int, .

, , . "1234" _wtoi int

.

int num = _wtoi (foo);

foo - LPTSTR.

edit: , LPTSTR UNICODE. _UNICODE. , atoi.

See http://msdn.microsoft.com/en-us/library/yd5xkb5c(VS.80).aspx

-1
source

Source: https://habr.com/ru/post/1702599/


All Articles