
- •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 8 Support Manager Functions
CToPStr
syntax |
int32 |
CToPStr(cstr, pstr); |
CToPStr converts a C string to a Pascal string. This function works even if the pointers cstr and pstr refer to the same memory location. If the length of cstr is greater than 255 characters, the function converts only the first 255 characters. The function assumes that pstr is large enough to contain cstr.
Parameter |
Type |
Description |
cstr |
CStr |
Pointer to a C string. |
pstr |
PStr |
Pointer to a Pascal string. |
returns The length of the string, truncated to a maximum of 255 characters.
FileNameCmp |
|
*Macro* |
syntax |
int32 |
FileNameCmp(s1, s2); |
FileNameCmp lexically compares two file names, to determine whether one is less than, the same as, or greater than the other. This comparison uses the same case sensitivity as the file system (that is, case insensitive for the Macintosh and the PC, case sensitive for the Sun SPARCstation).
Parameter |
Type |
Description |
s1 |
PStr |
Pointer to a Pascal string. |
s2 |
PStr |
Pointer to a Pascal string. |
returns |
<0, 0, or >0 if s1 is less than, the same as, or greater than s2. Returns <0 if s1 |
|
|
is an initial substring of s2. |
|
|
|
|
FileNameIndCmp |
|
*Macro* |
syntax |
int32 |
FileNameIndCmp(s1p, s2p); |
FileNameIndCmp is the same as FileNameCmp, except you pass the function handles to the string data instead of pointers. You can use FileNameIndCmp to compare two file names and lexically determine whether one is less than, the same as, or greater than the other. This comparison uses the same case sensitivity as the file
© National Instruments Corporation |
8-11 |
LabVIEW Code Interface Reference Manual |
Chapter 8 Support Manager Functions
system (that is, case insensitive for the Macintosh and the PC, and case sensitive for the Sun SPARCstation).
Parameter |
Type |
Description |
s1p |
PStr * |
Pointer to a Pascal string. |
s2p |
PStr * |
Pointer to a Pascal string. |
returns |
<0, 0, or >0 if s1 is less than, the same as, or greater than s2. Returns <0 if s1 |
|
|
is an initial substring of s2. |
|
|
|
|
FileNameNCmp |
|
*Macro* |
syntax |
int32 |
FileNameNCmp(s1, s2, n); |
FileNameNCmp lexically compares two file names to determine whether one is less than, the same as, or greater than the other, limiting the comparison to n characters. This comparison uses the same case sensitivity as the file system (that is, case insensitive for the Macintosh and the PC, case sensitive for the Sun SPARCstation).
Parameter |
Type |
Description |
s1 |
CStr |
Pointer to a C string. |
s2 |
CStr |
Pointer to a C string. |
n |
uInt32 |
Maximum number of characters to compare. |
returns |
<0, 0, or >0 if s1 is less than, the same as, or greater than s2. Returns <0 if s1 |
|
|
is an initial substring of s2. |
|
|
|
|
HexChar
syntax int32 HexChar(n);
HexChar returns the ASCII character in hex that represents the specified value n (0<=n<=15).
|
Parameter |
Type |
Description |
|
n |
int32 |
Decimal value between 0 and 15. |
returns |
The corresponding ASCII hex character. If n is out of range, the ASCII |
||
|
|
character corresponding to n modulo 16 is returned. |
|
|
|
|
|
LabVIEW Code Interface Reference Manual |
8-12 |
© National Instruments Corporation |
Chapter 8 Support Manager Functions
IsAlpha
syntax |
Bool32 |
IsAlpha(c); |
IsAlpha returns TRUE if the character c is a lowercase or uppercase letter (that is, in the set a to z or A to Z). On the SPARCstation, this function also returns TRUE for international characters (à, á, Ä, and so on).
|
Parameter |
Type |
Description |
|
c |
char |
Character that you want to analyze. |
returns |
TRUE if the character is an alphabetic character, and FALSE otherwise. |
||
|
|
|
|
IsDigit
syntax Bool32 IsDigit(c);
IsDigit returns TRUE if the character c is between 0 and 9.
|
Parameter |
Type |
Description |
|
c |
char |
Character that you want to analyze. |
returns |
TRUE if the character is a numerical digit, and FALSE otherwise. |
||
|
|
|
|
IsLower
syntax Bool32 IsLower(c);
IsLower returns TRUE if the character c is a lowercase letter (that is, in the set a to z). On the SPARCstation, this function also returns TRUE for lowercase international characters (ó, ö, and so on).
|
Parameter |
Type |
Description |
|
c |
char |
Character that you want to analyze. |
returns |
TRUE if the character is a lowercase letter, and FALSE otherwise. |
||
|
|
|
|
IsUpper
syntax Bool32 IsUpper(c);
© National Instruments Corporation |
8-13 |
LabVIEW Code Interface Reference Manual |
Chapter 8 Support Manager Functions
IsUpper returns TRUE if the character c is between an uppercase letter (that is, in the set A to Z). On the SPARCstation, this function also returns TRUE for uppercase international characters (Ó, Ä, and so on).
|
Parameter |
Type |
Description |
|
c |
char |
Character that you want to analyze. |
returns |
TRUE if the character is an uppercase letter, and FALSE otherwise. |
||
|
|
|
|
LStrBuf |
|
|
*Macro* |
||
syntax |
uChar |
*LStrBuf(s); |
|||
|
LStrBuf returns the address of the string data of a long Pascal string (that is, the |
||||
|
address of s->str). |
|
|
|
|
|
Parameter |
Type |
|
Description |
|
|
s |
LStrPtr |
Pointer to a long Pascal string. |
||
returns |
The address of the string data of the long Pascal string. |
||||
|
|
|
|
|
|
LStrCmp |
|
|
|
|
|
syntax |
LStrPtr |
LStrCmp(l1p, l2p); |
LStrCmp lexically compares two long Pascal strings to determine whether one is less than, the same as, or greater than the other. This comparison is case sensitive.
Parameter |
Type |
Description |
l1p |
LStrPtr |
Pointer to a long Pascal string. |
l2p |
LStrPtr |
Pointer to a long Pascal string. |
returns |
<0, 0, or >0 if s1 is less than, the same as, or greater than s2. Returns <0 if s1 |
|
|
is an initial substring of s2. |
|
|
|
|
LStrLen |
|
*Macro* |
syntax |
int32 |
LStrLen(s); |
LStrLen returns the length of a long Pascal string (that is, s->cnt).
LabVIEW Code Interface Reference Manual |
8-14 |
© National Instruments Corporation |