LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Path to String conversion problem on RT target

Hello.

Here my problem:

 

I need to translate a string to a file path in order to write a file on my RT target (compact rio).

 

My code is:

 

nook.PNG

 

It doesn't create any file on my RT. Using a probe it seems the data are right. If I try to run the same code on the host it works correctly.

It is not an incorrect path or privileges permission problem, because If I try to write a code like the follow:

 

ok.PNG

it works correclty and a new "Test.log" file is created. Does anyone know where is the problem?

 

I need to work with a string because the filename will be based on date and time creation.

 

Thank you all

 

fpia

0 Kudos
Message 1 of 4
(2,999 Views)

Ok, solved.

 

Here the solution:

 

solution.PNG

 

Using the Path costant, I had to write the file path with MS-DOS syntax (I mean "C:\filename") on RT. Not clear why but I was not able to work with a syntax unix-like "/filename"

Using the String to Path function, I had to write the right file path "/filename".

 

fpia

 

0 Kudos
Message 2 of 4
(2,996 Views)

This depends on what RT target you're using.  

 

If you're using a PharLap ETS-based RT target, stating "C:\foo.txt" will work as expected.

 

However, if you're using a VxWorks-based RT target, the drive specification is CASE-SENSITIVE.  You must use a LOWER-CASE drive specifier, such as "c:\foo.txt" - this is because of a limitation imposed by WindRiver.

 

When you use the /foo.txt, this is merely assuming that the drive you want is "drive c" - with this syntax you could also use "/c/foo.txt", but similarly /C/foo.txt is not valid.

 

-Danny

0 Kudos
Message 3 of 4
(2,982 Views)

If you use the build path.vi it wil adapt to the target it runs on.  Avoids a lot of confusion.

Message 4 of 4
(2,978 Views)