LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a "Path" to a TCHAR*

Hi,

   I have a .dll that requires the path of a file to be passed to it. This path should be of type "TCHAR*". Does anyone have any idea how I should go about this? Everything I try, I get a "Failed to open File"

Cheers, Alec

0 Kudos
Message 1 of 6
(3,674 Views)

It has to be a TCHAR - a regular old ANSI character string isn't good enough? Have you tried the Format to String VI? I attached it an example.


Andrew

Andrew
0 Kudos
Message 2 of 6
(3,659 Views)

No. I get a "File Open Error" no matter what I try:

I have tried sending it a string;

A path and selected "adapt to type";

I tried sending it a cluster of char (strings). and nothing seems to work

0 Kudos
Message 3 of 6
(3,652 Views)

The * symbol might indicate that it is a C / C++ DLL that is expecting a pointer. If this is the case you'd need to pass a pointer to the string rather than the string itself. That pretty much sums up my knowledge of C so I can't make any more suggestions.

 

If this is the case, there are a few related threads that can be found by searcing 'pointer to string'

 

Good luck,

Ian

0 Kudos
Message 4 of 6
(3,650 Views)

 


@alecjcook wrote:

Hi,

 Everything I try, I get a "Failed to open File"

Cheers, Alec


What exactly have you tried? What does your string look like? Are you remembering to use double backslashes for directory separators? In other words, for a path of C:\temp your string should be "C:\\temp".

 

0 Kudos
Message 5 of 6
(3,634 Views)

You should find out what TCHAR* actually is in the C/C++ code.  It could be multibyte or unicode.  Find its definition and you will probably find the solution to your problem.

0 Kudos
Message 6 of 6
(3,598 Views)