Incorrect name of named pipe (LPTSTR -> ?)

L

Lewap

Hi!

I've piece of code like follow:

<code>

LPTSTR lpszPipename = (LPTSTR) "\\\\.\\pipe\\testpipe";

hPipe = CreateNamedPipe(

lpszPipename, // pipe name

PIPE_ACCESS_DUPLEX | // read/write access

FILE_FLAG_OVERLAPPED,

PIPE_TYPE_MESSAGE | // message type pipe

PIPE_READMODE_MESSAGE | // message-read mode

PIPE_WAIT, // blocking mode

1, // number of instances (max. instances - PIPE_UNLIMITED_INSTANCES)

BUFSIZE, // output buffer size

BUFSIZE, // input buffer size

PIPE_TIMEOUT, // client time-out

NULL);

<code>

When I had first line like this:

LPTSTR lpszPipename = "\\\\.\\pipe\\testpipe";

Compiler show an error:

C2440: 'initializing' : cannot convert from 'const char [18]' to 'LPTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast,
C-style cast or function-style cast

so i change it into:
LPTSTR lpszPipename = (LPTSTR) "\\\\.\\pipe\\testpipe";

Now build process end properly but while i execute application I get an
error 123 "The file name, directory name, or volume label syntax is
incorrect." So, name of named pipe is wrong, I suppose.


That code is part of NT Service application, so I develop it under
Managed/Unmanaged C++. What should I do?

Thanks in advance for any help


Best regards,
Pawe³ Chmielarz
/software engineer/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top