- •Important Information
- •Warranty
- •Copyright
- •Trademarks
- •Organization of This Manual
- •Conventions Used in This Manual
- •Related Documentation
- •Customer Communication
- •Introduction
- •Classes of External Code
- •Supported Languages
- •Macintosh
- •Microsoft Windows 3.1
- •Microsoft Windows 95 and Windows NT
- •Solaris
- •Steps for Creating a CIN
- •1. Place the CIN on a Block Diagram
- •2. Add Input and Output Terminals to the CIN
- •Input-Output Terminals
- •Output-Only Terminals
- •3. Wire the Inputs and Outputs to the CIN
- •4. Create .c File
- •Special Macintosh Considerations
- •5. Compile the CIN Source Code
- •Macintosh
- •THINK C for 68K (Versions 5-7)
- •Symantec C++ 8.0 for Power Macintosh
- •Metrowerks CodeWarrior for 68K
- •Metrowerks CodeWarrior for Power Macintosh
- •Microsoft Windows 3.x
- •Watcom C Compiler
- •Microsoft Windows 95 and Windows NT
- •Microsoft SDK C/C++ Compiler
- •Visual C++ for Windows 95 or Windows NT
- •Solaris 1.x
- •Solaris 2.x
- •6. Load the CIN Object Code
- •LabVIEW Manager Routines
- •Online Reference
- •Pointers as Parameters
- •Debugging External Code
- •DbgPrintf
- •Debugging CINs Under Windows 95 and Windows NT
- •Debugging CINs Under Sun or Solaris
- •Debugging CINs Under HP-UX
- •Introduction
- •CIN .c File
- •How LabVIEW Passes Fixed Sized Data to CINs
- •Scalar Numerics
- •Scalar Booleans
- •Refnums
- •Clusters of Scalars
- •Return Value for CIN Routines
- •Examples with Scalars
- •1. Place the CIN on the Block Diagram
- •2. Add Two Input and Output Terminals to the CIN
- •3. Wire the Inputs and Outputs to the CIN
- •4. Create the CIN Source Code
- •5. Compile the CIN Source Code
- •Macintosh
- •THINK C for 68K and Symantec C++
- •Microsoft Windows 3.x
- •Watcom C Compiler
- •Microsoft Windows 95 and Windows NT
- •Microsoft SDK Compiler
- •Microsoft Visual C++ Compiler
- •Solaris 1.x, Solaris 2.x, and HP-UX
- •6. Load the CIN Object Code
- •Comparing Two Numbers, Producing a Boolean Scalar
- •How LabVIEW Passes Variably Sized Data to CINs
- •Alignment Considerations
- •Arrays and Strings
- •Paths (Path)
- •Clusters Containing Variably Sized Data
- •Resizing Arrays and Strings
- •SetCINArraySize
- •NumericArrayResize
- •Examples with Variably Sized Data
- •Concatenating Two Strings
- •Working with Clusters
- •CIN Routines
- •Data Spaces and Code Resources
- •CIN Routines: The Basic Case
- •Loading a VI
- •Unloading a VI
- •Loading a New Resource into the CIN
- •Compiling a VI
- •Running a VI
- •Saving a VI
- •Aborting a VI
- •Multiple References to the Same CIN
- •Reentrancy
- •Code Globals and CIN Data Space Globals
- •Examples
- •Using Code Globals
- •Using CIN Data Space Globals
- •Calling a Windows 3.1 Dynamic Link Library
- •Calling a 16-Bit DLL
- •1. Load the DLL
- •2. Get the address of the desired function
- •3. Describe the function
- •4. Call the function
- •Example: A CIN that Displays a Dialog Box
- •The Block Diagram
- •The CIN Code
- •Compiling the CIN
- •Optimization
- •Introduction
- •Creating Shared External Subroutines
- •External Subroutine
- •Macintosh
- •THINK C Compiler and CodeWarrior 68K Compiler
- •MPW Compiler
- •Solaris 1.x, Solaris 2.x, and HP-UX
- •Calling Code
- •Macintosh
- •THINK C Compiler
- •CodeWarrior 68K Compiler
- •MPW Compiler
- •Solaris 1.x, Solaris 2.x, and HP-UX
- •Simple Example
- •External Subroutine Example
- •Compiling the External Subroutine
- •Macintosh
- •THINK C Compiler and CodeWarrior 68K Compiler
- •MPW Compiler
- •Microsoft Windows 3.1
- •Watcom C Compiler
- •Microsoft Windows 95 and Windows NT
- •Solaris 1.x, Solaris 2.x, and HP-UX
- •Calling Code
- •Compiling the Calling Code
- •Macintosh
- •THINK C Compiler
- •CodeWarrior 68K Compiler
- •MPW Compiler
- •Microsoft Windows 3.1
- •Watcom C Compiler
- •Microsoft Windows 95 and Windows NT
- •Solaris 1.x, Solaris 2.x, and HP-UX
- •Introduction
- •Basic Data Types
- •Scalar Data Types
- •Booleans
- •Numerics
- •Complex Numbers
- •char Data Type
- •Dynamic Data Types
- •Arrays
- •Strings
- •C-Style Strings (CStr)
- •Pascal-Style Strings (PStr)
- •LabVIEW Strings (LStr)
- •Concatenated Pascal String (CPStr)
- •Paths (Path)
- •Memory-Related Types
- •Constants
- •Memory Manager
- •Memory Allocation
- •Static Memory Allocation
- •Dynamic Memory Allocation: Pointers and Handles
- •Memory Zones
- •Using Pointers and Handles
- •Simple Example
- •Reference to the Memory Manager
- •Memory Manager Data Structures
- •File Manager
- •Introduction
- •Identifying Files and Directories
- •Path Specifications
- •Conventional Path Specifications
- •Empty Path Specifications
- •LabVIEW Path Specification
- •File Descriptors
- •File Refnums
- •Support Manager
- •Allocating and Releasing Handles
- •Allocating and Releasing Pointers
- •Manipulating Properties of Handles
- •AZHLock
- •AZHPurge
- •AZHNoPurge
- •AZHUnlock
- •Memory Utilities
- •ClearMem
- •MoveBlock
- •SwapBlock
- •Handle and Pointer Verification
- •Memory Zone Utilities
- •File Manager Data Structures
- •File/Directory Information Record
- •File Type Record
- •Path Data Type
- •Permissions
- •Volume Information Record
- •File Manager Functions
- •Performing Basic File Operations
- •FCreate
- •FCreateAlways
- •FMClose
- •FMOpen
- •FMRead
- •FMWrite
- •Positioning the Current Position Mark
- •FMSeek
- •FMTell
- •Positioning the End-Of-File Mark
- •FGetEOF
- •FSetEOF
- •Flushing File Data to Disk
- •FFlush
- •FExists
- •FGetAccessRights
- •FGetInfo
- •FGetVolInfo
- •FSetAccessRights
- •FSetInfo
- •Getting Default Access Rights Information
- •FGetDefGroup
- •FListDir
- •FNewDir
- •Copying Files
- •FCopy
- •Moving and Deleting Files and Directories
- •FMove
- •FRemove
- •Locking a File Range
- •FLockOrUnlockRange
- •Matching Filenames with Patterns
- •FStrFitsPat
- •Creating Paths
- •FAddPath
- •FAppendName
- •FAppPath
- •FEmptyPath
- •FMakePath
- •FNotAPath
- •FRelPath
- •Disposing Paths
- •FDisposePath
- •Duplicating Paths
- •FPathCpy
- •FPathToPath
- •Extracting Information from a Path
- •FDepth
- •FDirName
- •FName
- •FNamePtr
- •FVolName
- •FArrToPath
- •FFlattenPath
- •FPathToArr
- •FPathToAZString
- •FPathToDSString
- •FStringToPath
- •FTextToPath
- •FUnFlattenPath
- •Comparing Paths
- •FIsAPath
- •FIsAPathOrNotAPath
- •FIsEmptyPath
- •FPathCmp
- •Determining a Path Type
- •FGetPathType
- •FIsAPathOfType
- •FSetPathType
- •Manipulating File Refnums
- •FDisposeRefNum
- •FIsARefNum
- •FNewRefNum
- •FRefNumToFD
- •FRefNumToPath
- •Byte Manipulation Operations
- •Mathematical Operations
- •For THINK C Users
- •RandomGen
- •String Manipulation
- •BlockCmp
- •CPStrCmp
- •CPStrIndex
- •CPStrInsert
- •CPStrRemove
- •CPStrReplace
- •CPStrSize
- •CToPStr
- •HexChar
- •IsAlpha
- •IsDigit
- •IsLower
- •IsUpper
- •LStrCmp
- •LToPStr
- •PPStrCaseCmp
- •PPStrCmp
- •PStrCaseCmp
- •PStrCat
- •PStrCmp
- •PStrCpy
- •PStrNCpy
- •PToCStr
- •PToLStr
- •StrCat
- •StrCmp
- •StrCpy
- •StrLen
- •StrNCaseCmp
- •StrNCmp
- •StrNCpy
- •ToLower
- •ToUpper
- •Utility Functions
- •BinSearch
- •QSort
- •Time Functions
- •ASCIITime
- •DateCString
- •DateToSecs
- •MilliSecs
- •SecsToDate
- •TimeCString
- •TimeInSecs
- •Microsoft Windows 3.1, Windows 95, and Windows NT
- •Macintosh
- •How do I debug my CIN?
- •Can LabVIEW be used to call a DLL in Windows?
- •Glossary
- •Index
Chapter 7 File Manager Functions
err = FVolName(path, path);
/* the parent path writes over the existing path */
|
Parameter |
Type |
Description |
|
path |
Path |
Path whose volume path you want to determine. |
|
vol |
Path |
Parameter in which FVolName stores the volume |
|
|
|
path. |
returns |
MgErr, which can contain the errors in the following list. |
||
|
Error |
Description |
|
|
mgArgErr |
A bad argument was passed to the function. Verify path. |
|
|
|
|
|
Converting Paths to and from Other Representations
FArrToPath
syntax |
MgErr |
FArrToPath(arr, relative, path); |
FArrToPath converts a specified one-dimensional LabVIEW array of strings to a path of the type specified by relative. Each string in the specified array is converted in order into a component name of the resulting path.
If no error occurs, path is set to a path whose component names are the strings in arr. If an error occurs, path is set to the canonical invalid path.
|
Parameter |
Type |
Description |
|
arr |
UHandle |
The (DS) handle containing the array of strings |
|
|
|
which you wish to convert to a path. |
|
relative |
Bool32 |
If relative is TRUE, then the resulting path is |
|
|
|
relative; otherwise, the resulting path is absolute. |
|
path |
Path |
Path where FArrToPath stores the resulting path. |
|
|
|
This path must already have been allocated. |
returns |
MgErr, which can contain the errors in the following list. |
||
|
Error |
Description |
|
|
mgArgErr |
A bad argument was passed to the function. Verify path. |
|
|
mFullErr |
Insufficient memory. |
|
|
|
|
|
National Instruments Corporation |
7-31 |
LabVIEW Code Interface Reference Manual |
Chapter 7 File Manager Functions
FFlattenPath
syntax int32 FFlattenPath(p, fp);
FFlattenPath converts a path into a flat form that you can use to write the path as information to a file. The function stores the resulting flat path in a pre-allocated buffer and returns the number of bytes.
You can determine the size needed for the flattened path by passing NULL for fp, in which case the function returns the necessary size without writing anything into the location pointed to by fp.
Parameter |
Type |
Description |
p |
Path |
Path you want to flatten. |
fp |
UPtr |
Address in which FFlattenPath stores the |
|
|
resulting flattened path. If this value is NULL, |
|
|
FFlattenPath does not write anything to this |
|
|
address, but does return the size that the flattened |
|
|
path would require. |
|
|
See the Pointers as Parameters section of |
|
|
Chapter 1, CIN Overview, for more information |
|
|
about using this parameter. |
returns int32, indicating the number of bytes required to store the flattened path.
FPathToArr
syntax MgErr FPathToArr(path, relativePtr, arr);
FPathToArr converts a specified path to a one-dimensional LabVIEW array of strings and determines whether the specified path is relative. Each component name of the specified path is converted in order into a string in the resulting array.
If no error occurs, arr is set to an array of strings containing the component names of path. If an error occurs, arr is set to an empty array.
Parameter |
Type |
Description |
path |
Path |
The path which you wish to convert to an array of |
|
|
strings. |
relativePtr |
Bool32 * |
Address at which to store a boolean value telling |
|
|
whether the specified path is relative. |
LabVIEW Code Interface Reference Manual |
7-32 |
National Instruments Corporation |
|
|
|
Chapter 7 File Manager Functions |
|
|
|
|
See the Pointers as Parameters section of |
|
|
|
|
Chapter 1, CIN Overview, for more information |
|
|
|
|
about using this parameter. |
|
|
arr |
UHandle |
(DS) Handle where FPathToArr stores the |
|
|
|
|
resulting array of strings. This handle must already |
|
|
|
|
have been allocated. |
|
returns |
MgErr, which can contain the errors in the following list. |
|||
|
Error |
Description |
|
|
|
mgArgErr |
Badly formed path or unallocated array. |
||
|
mFullErr |
Insufficient memory. |
||
|
|
|
|
|
FPathToAZString
syntax MgErr FPathToAZString(p, txt);
FPathToAZString converts a specified path to an LStr and stores the string as an application zone handle. The LStr contains the platform-specific syntax for the path.
|
Parameter |
Type |
Description |
|
|
p |
Path |
Path that you want to convert to a string. |
|
|
txt |
LStrHandle * Address at which FPathToAZString stores the |
||
|
|
|
resulting string. If the value at txt is nonzero, the |
|
|
|
|
function assumes that it is a valid handle, resizes the |
|
|
|
|
handle, fills in its value, and stores the handle at the |
|
|
|
|
address referred to by txt. |
|
|
|
|
See the Pointers as Parameters section of |
|
|
|
|
Chapter 1, CIN Overview, for more information |
|
|
|
|
about using this parameter. |
|
returns |
MgErr, which can contain the errors in the following list. |
|||
|
Error |
Description |
|
|
|
mgArgErr |
A bad argument was passed to the function. Verify path. |
||
|
mFullErr |
Insufficient memory. |
||
|
fIOErr |
Unspecified I/O error occurred. |
||
|
|
|
|
|
National Instruments Corporation |
7-33 |
LabVIEW Code Interface Reference Manual |
Chapter 7 File Manager Functions
FPathToDSString
syntax MgErr FPathToDSString(p, txt);
FPathToDSString converts a specified path to an LStr and stores the string as a data space zone handle. The LStr contains the platform-specific syntax for the path.
|
Parameter |
Type |
Description |
|
|
p |
Path |
Path that you want to convert to a string. |
|
|
txt |
LStrHandle * Address at which FPathToDSString stores the |
||
|
|
|
resulting string. If the value at txt is nonzero, the |
|
|
|
|
function assumes that it is a valid handle, resizes the |
|
|
|
|
handle, fills in its value, and stores the handle at the |
|
|
|
|
address referred to by txt. |
|
|
|
|
See the Pointers as Parameters section of |
|
|
|
|
Chapter 1, CIN Overview, for more information |
|
|
|
|
about using this parameter. |
|
returns |
MgErr, which can contain the errors in the following list. |
|||
|
Error |
Description |
|
|
|
mgArgErr |
A bad argument was passed to the function. Verify path. |
||
|
mFullErr |
Insufficient memory. |
||
|
fIOErr |
Unspecified I/O error occurred. |
||
|
|
|
|
|
FStringToPath
syntax MgErr FStringToPath(text, p);
FStringToPath creates a path from an LStr. The LStr contains the platformspecific syntax for a path.
Parameter |
Type |
Description |
text |
LStrHandle |
String that contains the path in platform-specific |
|
|
syntax. |
p |
Path * |
Address at which FStringToPath stores the |
|
|
resulting path. If the value at p is non-zero, the |
|
|
function assumes that it is a valid path, resizes the |
|
|
path, and fills in its value. If the value at p is zero |
|
|
(NULL), the function creates a new path, fills in its |
|
|
value, and stores the path at the address referred to |
|
|
by p. |
LabVIEW Code Interface Reference Manual |
7-34 |
National Instruments Corporation |