05-04-2012 05:09 AM
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:
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:
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
05-04-2012 05:28 AM
Ok, solved.
Here the solution:
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
05-04-2012 01:43 PM
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
05-04-2012 01:57 PM
If you use the build path.vi it wil adapt to the target it runs on. Avoids a lot of confusion.