Re: CString to const char*

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi

I was thinking along the lines of gethostbyname which asks for const
char*.

I know the sockets use Byte arrays, that wasn't actually the problem to
be totally honest.

Anyway, not to worry now I have a solution. Thanks for your time.

Nick.

"Jochen Kalmbach [MVP]" <nospam-Jochen.Kalmbach@xxxxxxxxx> wrote in message
news:OipR4nj4GHA.3556@xxxxxxxxxxxxxxxxxxxxxxx
Hello NickP!

BTW, you can use TCHAR instead of char and use your normal functions
(MessageBox instead of MessageBoxA) and avoid all the hassle...

Unfortunately I do not have control over the methods being called, i.e.
the socket functions, or are there TCHAR equivilents?

Sockets do neither know about "char" nor about "wchar_t" (and also not
about TCHAR)!!!

It just accepts an pointer to a byte-array (which is char*).

What you provide in this array is up to you. You can sent whatever you
want. This has nothing to do with char*/wchar_t* not TCHAR*!

Read the specification of your data which is required by the receiver of
the data-stream; then you know what to send!

Greetings
Jochen


.