The MacView

Virtual Instrumentation from a Mac perspective

My Photo
Name:
Location: Pflugerville, TX, United States

Friday, December 30, 2005

Advanced String VIs for Cross Platform Support

In vi.lib/AdvancedString there are some very useful VIs when it comes to cross platform development.


Command Line String To Path.vi

This will convert a path String generated by call to System Exec.vi (Connectivity -> Libraries & Executables) to a LabVIEW path. On non-Mac platforms, it does the same thing as the String To Path primitive. On the Mac, it asks the OS to convert it.


Path To Command Line String.vi

This will convert a Path to a path String that can be used in generating a command to pass to a call to System Exec.vi (Connectivity -> Libraries & Executables) to a LabVIEW path. On non-Mac platforms, it does the same thing as the Path To String primitive. On the Mac, it asks the OS to convert it.


Relative Path To Platform Independent String.vi

Takes a relative path (one that does not start with a disk name) and converts it to a URL-like path string (uses forward slashes as separators) on all platforms.


Normalize End Of Line.vi

Converts all the end of line characters (Mac [\r], UNIX [\n] or DOS [\r\n]) in a string into another line ending type. There are two line ending types that you can convert to that are a little different. The Native line ending type is the line ending character that LabVIEW uses on the platform (for the Mac, its carriage return [\r]). This is equivalent to using the End Of Line Constant (Programming -> String). There is also Native Command Line, which is the same as Native on non-Mac platforms. On the Mac, it is line feed [\n] (UNIX). This way you can generate shell scripts, for example, you could use this to make sure it would be in UNIX format.

Using this VI can help make your code line-ending-agnostic, which makes it more robust.

0 Comments:

Post a Comment

<< Home

The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of my employer.