National Instruments 320682C User Manual

LabWindows®/CVI
Standard Libraries
Reference Manual
July 1996 Edition
© Copyright 1994, 1996 National Instruments Corporation.
All rights reserved.
Internet Support
gpib.support@natinst.com
GPIB:
daq.support@natinst.com
DAQ:
vxi.support@natinst.com
VXI: LabVIEW: LabWindows: HiQ: VISA: Lookout: FTP Site: Web Address:
BBS United States: (512) 794-5422 or (800) 327-3077 BBS United Kingdom: 01635 551422 BBS France: 1 48 65 15 59
(512) 418-1111
lv.support@natinst.com
lw.support@natinst.com
hiq.support@natinst.com
visa.support@natinst.com
lookout.support@natinst.com
ftp.natinst.com
www.natinst.com
Bulletin Board Support
FaxBack Support
Telephone Support (U.S.)
Tel: (512) 795-8248 Fax: (512) 794-5678
International Offices
Australia 03 9 879 9422, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Canada (Ontario) 519 622 9310, Canada (Québec) 514 694 8521, Denmark 45 76 26 00, Finland 90 527 2321, France 1 48 14 24 24, Germany 089 741 31 30, Hong Kong 2645 3186, Italy 02 413091, Japan 03 5472 2970, Korea 02 596 7456, Mexico 95 800 010 0793, Netherlands 0348 433466, Norway 32 84 84 00, Singapore 2265886, Spain 91 640 0085, Sweden 08 730 49 70, Switzerland 056 200 51 51, Taiwan 02 377 1200, U.K. 01635 523545
National Instruments Corporate Headquarters
6504 Bridge Point Parkway Austin, TX 78730-5039 Tel: (512) 794-0100

Warranty

The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty.
National Instruments believes that the information in this manual is accurate. The document has been carefully reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
E
XCEPT AS SPECIFIED HEREIN
SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
C
USTOMER’S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL
I
NSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA CONSEQUENTIAL DAMAGES
, N
ATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND
. N
ATIONAL INSTRUMENTS
,
PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR
,
EVEN IF ADVISED OF THE POSSIBILITY THEREOF
. This limitation of the liability of
.
National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages, defects, malfunctions, or service failures caused by owner’s failure to follow the National Instruments installation, operation, or maintenance instructions; owner’s modification of the product; owner’s abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control.

Copyright

Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation.

Trademarks

NI-DAQ®, NI-488.2™, and NI-488.2M™ are trademarks of National Instruments Corporation.
Product and company names listed are trademarks or trade names of their respective companies.
WARNING REGARDING MEDICAL AND CLINICAL USE
OF NATIONAL INSTRUMENTS PRODUCTS
National Instruments products are not designed with components and testing intended to ensure a level of reliability suitable for use in treatment and diagnosis of humans. Applications of National Instruments products involving medical or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the part of the user or application designer. Any use or application of National Instruments products for or involving medical or clinical treatment must be performed by properly trained and qualified medical personnel, and all traditional medical safeguards, equipment, and procedures that are appropriate in the particular situation to prevent serious injury or death should always continue to be used when National Instruments products are being used. National Instruments products are NOT intended to be a substitute for any form of established process, procedure, or equipment used to monitor or safeguard human health and safety in medical or clinical treatment.

Contents

_____________________________________________________________________________
About This Manual
Organization of This Manual .......................................................................................xvii
Conventions Used in This Manual...............................................................................xix
The LabWindows/CVI Documentation Set .................................................................xx
Related Documentation................................................................................................xx
Customer Communication ...........................................................................................xx
Chapter 1 ANSI C Library
Low-Level I/O Functions.............................................................................................1-2
Standard Language Additions......................................................................................1-2
Character Processing....................................................................................................1-5
String Processing..........................................................................................................1-5
Input/Output Facilities .................................................................................................1-6
errno Set by File I/O Functions....................................................................................1-6
Mathematical Functions...............................................................................................1-6
Time and Date Functions .............................................................................................1-6
Control Functions.........................................................................................................1-7
ANSI C Library Function Reference............................................................................1-9
fdopen...............................................................................................................1-9
................................................................................................................1-1
...........................................................................................................xvii
Chapter 2 Formatting and I/O Library
Formatting and I/O Library Function Overview..........................................................2-1
The Formatting and I/O Library Function Panels............................................2-1
The String Manipulation Functions .................................................................2-3
The Special Nature of the Formatting and Scanning Functions.......................2-3
Formatting and I/O Library Function Reference..........................................................2-4
ArrayToFile......................................................................................................2-4
CloseFile ..........................................................................................................2-7
CompareBytes..................................................................................................2-7
CompareStrings................................................................................................2-8
CopyBytes........................................................................................................2-9
CopyString .......................................................................................................2-10
FileToArray......................................................................................................2-11
FillBytes...........................................................................................................2-13
FindPattern.......................................................................................................2-13
Fmt ...................................................................................................................2-14
FmtFile.............................................................................................................2-15
FmtOut .............................................................................................................2-16
GetFileInfo.......................................................................................................2-17
........................................................................................2-1
© National Instruments Corporation v LabWindows/CVI Standard Libraries
Contents
GetFmtErrNdx..................................................................................................2-18
GetFmtIOError.................................................................................................2-18
GetFmtIOErrorString.......................................................................................2-19
NumFmtdBytes................................................................................................2-20
OpenFile...........................................................................................................2-20
ReadFile ...........................................................................................................2-22
ReadLine ..........................................................................................................2-23
Scan..................................................................................................................2-24
ScanFile............................................................................................................2-25
ScanIn...............................................................................................................2-25
SetFilePtr..........................................................................................................2-26
StringLength.....................................................................................................2-28
StringLowerCase..............................................................................................2-28
StringUpperCase ..............................................................................................2-29
WriteFile...........................................................................................................2-29
WriteLine .........................................................................................................2-30
Using the Formatting and Scanning Functions............................................................2-31
Introductory Formatting and Scanning Examples............................................2-31
Formatting Functions.......................................................................................2-32
Formatting Functions—Format String.................................................2-33
Formatting Modifiers ...........................................................................2-35
Formatting Integer Modifiers (%i, %d, %x, %o, %c)..............2-35
Formatting Floating-Point Modifiers (%f)...............................2-37
Formatting String Modifiers (%s)............................................2-38
Fmt, FmtFile, FmtOut—Asterisks (*) Instead of Constants
in Format Specifiers.............................................................................2-39
Fmt, FmtFile, FmtOut—Literals in the Format String.........................2-40
Scanning Functions..........................................................................................2-40
Scanning Functions—Format String....................................................2-41
Scanning Modifiers..............................................................................2-43
Scanning Integer Modifiers (%i, %d, %x, %o, %c).................2-43
Scanning Floating-Point Modifiers (%f)..................................2-45
Scanning String Modifiers (%s)...............................................2-46
Scan, ScanFile, ScanIn—Asterisks (*) Instead of Constants
in Format Specifiers.............................................................................2-48
Scan, ScanFile, ScanIn—Literals in the Format String .......................2-48
Formatting and I/O Library Programming Examples..................................................2-49
Fmt/FmtFile/FmtOut Examples in C ...............................................................2-50
Integer to String....................................................................................2-50
Long Integer to String..........................................................................2-51
Real to String in Floating-Point Notation ............................................2-51
Real to String in Scientific Notation....................................................2-52
Integer and Real to String with Literals...............................................2-53
Two Integers to ASCII File with Error Checking................................2-53
Real Array to ASCII File in Columns and with Comma Separators ...2-53
LabWindows/CVI Standard Libraries vi © National Instruments Corporation
Contents
Integer Array to Binary File, Assuming a Fixed
Number of Elements.............................................................................2-54
Real Array to Binary File, Assuming a Fixed
Number of Elements.............................................................................2-54
Real Array to Binary File, Assuming a Variable
Number of Elements.............................................................................2-55
A Variable Portion of a Real Array to a Binary File............................2-55
Concatenating Two Strings..................................................................2-56
Appending to a String ..........................................................................2-56
Creating an Array of File Names .........................................................2-57
Writing a Line Containing an Integer with Literals to
the Standard Output..............................................................................2-58
Writing to the Standard Output without
a Linefeed/Carriage Return..................................................................2-58
Scan/ScanFile/ScanIn Examples in C..............................................................2-59
String to Integer....................................................................................2-59
String to Long Integer..........................................................................2-60
String to Real........................................................................................2-60
String to Integer and Real.....................................................................2-61
String to String.....................................................................................2-62
String to Integer and String..................................................................2-63
String to Real, Skipping over Non-Numeric Characters
in the String..........................................................................................2-63
String to Real, After Finding a Semicolon in the String......................2-64
String to Real, After Finding a Substring in the String........................2-64
String with Comma-Separated ASCII Numbers to Real Array ...........2-65
Scanning Strings That Are Not NUL-Terminated ...............................2-65
Integer Array to Real Array..................................................................2-66
Integer Array to Real Array with Byte Swapping................................2-66
Integer Array Containing 1-Byte Integers to Real Array.....................2-66
String Containing Binary Integers to Integer Array.............................2-67
String Containing an IEEE-Format Real Number
to a Real Variable.................................................................................2-67
ASCII File to Two Integers with Error Checking................................2-68
ASCII File with Comma Separated Numbers to Real Array,
with Number of Elements at Beginning of File ...................................2-68
Binary File to Integer Array, Assuming a Fixed
Number of Elements.............................................................................2-69
Binary File to Real Array, Assuming a Fixed Number of Elements....2-69
Binary File to Real Array, Assuming a Variable
Number of Elements.............................................................................2-69
Reading an Integer from the Standard Input........................................2-70
Reading a String from the Standard Input............................................2-70
Reading a Line from the Standard Input..............................................2-71
© National Instruments Corporation vii LabWindows/CVI Standard Libraries
Contents
Chapter 3 Analysis Library
Analysis Library Function Overview...........................................................................3-1
The Analysis Library Function Panels.............................................................3-1
Reporting Analysis Errors................................................................................3-4
Analysis Library Function Reference...........................................................................3-4
Abs1D...............................................................................................................3-4
Add1D..............................................................................................................3-5
Add2D..............................................................................................................3-5
Clear1D ............................................................................................................3-6
Copy1D ............................................................................................................3-7
CxAdd ..............................................................................................................3-7
CxAdd1D .........................................................................................................3-8
CxDiv...............................................................................................................3-9
CxDiv1D ..........................................................................................................3-10
CxLinEv1D ......................................................................................................3-11
CxMul ..............................................................................................................3-12
CxMul1D..........................................................................................................3-12
CxRecip............................................................................................................3-13
CxSub...............................................................................................................3-14
CxSub1D..........................................................................................................3-15
Determinant......................................................................................................3-16
Div1D...............................................................................................................3-16
Div2D...............................................................................................................3-17
DotProduct .......................................................................................................3-18
GetAnalysisErrorString....................................................................................3-19
Histogram.........................................................................................................3-19
InvMatrix..........................................................................................................3-20
LinEv1D...........................................................................................................3-21
LinEv2D...........................................................................................................3-22
MatrixMul ........................................................................................................3-23
MaxMin1D.......................................................................................................3-24
MaxMin2D.......................................................................................................3-24
Mean.................................................................................................................3-25
Mul1D ..............................................................................................................3-26
Mul2D ..............................................................................................................3-27
Neg1D ..............................................................................................................3-28
Set1D................................................................................................................3-28
Sort...................................................................................................................3-29
StdDev..............................................................................................................3-29
Sub1D...............................................................................................................3-30
Sub2D...............................................................................................................3-31
Subset1D ..........................................................................................................3-32
ToPolar.............................................................................................................3-32
...............................................................................................................3-1
Hints for Using Analysis Function Panels ...........................................3-3
LabWindows/CVI Standard Libraries viii © National Instruments Corporation
ToPolar1D........................................................................................................3-33
ToRect..............................................................................................................3-34
ToRect1D.........................................................................................................3-35
Transpose .........................................................................................................3-36
Error Conditions...........................................................................................................3-37
Chapter 4 GPIB/GPIB-488.2 Library
GPIB Library Function Overview................................................................................4-1
GPIB Functions Library Function Panels ........................................................4-1
GPIB Library Concepts................................................................................................4-5
GPIB Libraries and the GPIB Dynamic Link Library/Device Driver..............4-5
Guidelines and Restrictions for Using the GPIB Libraries..............................4-6
Device and Board Functions............................................................................4-7
Automatic Serial Polling..................................................................................4-7
Autopolling Compatibility...................................................................4-8
Hardware Interrupts and Autopolling...............................................................4-8
Read and Write Termination............................................................................4-9
Timeouts...........................................................................................................4-9
Global Variables for the GPIB Library............................................................4-10
Different Levels of Functionality Depending on Platform and GPIB Board...4-10
Windows 95..........................................................................................4-10
Native 32-Bit Driver.................................................................4-10
Compatibility Driver................................................................4-11
Windows NT........................................................................................4-11
Limitations on Transfer Size............................................................................4-11
Multithreading..................................................................................................4-11
Notification of SRQ and Other GPIB Events...................................................4-12
Synchronous Callbacks........................................................................4-12
Asynchronous Callbacks......................................................................4-12
Driver Version Requirements...............................................................4-12
GPIB Function Reference ............................................................................................4-13
CloseDev..........................................................................................................4-13
CloseInstrDevs.................................................................................................4-14
ibInstallCallback...............................................................................................4-14
SRQI, RQS, and Auto Serial Polling...................................................4-16
CallbackFunction .................................................................................4-17
ibNotify ............................................................................................................4-17
eventMask ............................................................................................4-18
SRQI, RQS, and Auto Serial Polling...................................................4-19
CallbackFunction .................................................................................4-19
Restrictions on Operations in Asynchronous Callbacks......................4-20
OpenDev...........................................................................................................4-21
ThreadIbcnt ......................................................................................................4-22
ThreadIbcntl.....................................................................................................4-22
Contents
...........................................................................................4-1
© National Instruments Corporation ix LabWindows/CVI Standard Libraries
Contents
ThreadIberr.......................................................................................................4-23
ThreadIbsta.......................................................................................................4-25
Chapter 5 RS-232 Library
RS-232 Library Function Overview.............................................................................5-1
The RS-232 Library Function Panels...............................................................5-1
Using RS-485...................................................................................................5-3
Reporting RS-232 Errors..................................................................................5-3
XModem File Transfer Functions....................................................................5-3
Troubleshooting ...............................................................................................5-3
RS-232 Cable Information...............................................................................5-4
Handshaking.....................................................................................................5-6
RS-232 Library Function Reference ............................................................................5-8
CloseCom.........................................................................................................5-8
ComBreak.........................................................................................................5-9
ComFromFile...................................................................................................5-9
ComRd .............................................................................................................5-11
ComRdByte......................................................................................................5-12
ComRdTerm.....................................................................................................5-12
ComSetEscape..................................................................................................5-14
ComToFile .......................................................................................................5-15
ComWrt............................................................................................................5-16
ComWrtByte ....................................................................................................5-17
FlushInQ...........................................................................................................5-18
FlushOutQ........................................................................................................5-19
GetComStat......................................................................................................5-19
GetInQLen........................................................................................................5-20
GetOutQLen.....................................................................................................5-21
GetRS232ErrorString.......................................................................................5-22
InstallComCallback..........................................................................................5-22
OpenCom .........................................................................................................5-25
OpenComConfig ..............................................................................................5-26
ReturnRS232Err...............................................................................................5-28
SetComTime ....................................................................................................5-29
SetCTSMode....................................................................................................5-30
SetXMode.........................................................................................................5-31
XModemConfig ...............................................................................................5-31
XModemReceive..............................................................................................5-33
XModemSend...................................................................................................5-34
Error Conditions...........................................................................................................5-36
.................................................................................................................5-1
Software Handshaking .........................................................................5-6
Hardware Handshaking........................................................................5-7
LabWindows/CVI Standard Libraries x © National Instruments Corporation
Chapter 6 DDE Library
DDE Library Function Overview.................................................................................6-1
The DDE Library Function Panels...................................................................6-1
DDE Clients and Servers..................................................................................6-2
The DDE Callback Function............................................................................6-2
DDE Links........................................................................................................6-4
A DDE Library Example Using Microsoft Excel and LabWindows/CVI.......6-5
DDE Library Function Reference ................................................................................6-6
AdviseDDEDataReady.....................................................................................6-6
BroadcastDDEDataReady................................................................................6-8
ClientDDEExecute...........................................................................................6-10
ClientDDERead................................................................................................6-10
ClientDDEWrite...............................................................................................6-12
ConnectToDDEServer .....................................................................................6-13
DisconnectFromDDEServer.............................................................................6-15
GetDDEErrorString..........................................................................................6-15
RegisterDDEServer..........................................................................................6-16
ServerDDEWrite..............................................................................................6-19
SetUpDDEHotLink..........................................................................................6-20
SetUpDDEWarmLink......................................................................................6-21
TerminateDDELink..........................................................................................6-22
UnregisterDDEServer ......................................................................................6-23
Error Conditions...........................................................................................................6-23
Contents
......................................................................................................................6-1
Chapter 7 TCP Library
TCP Library Function Overview..................................................................................7-1
TCP Library Function Reference.................................................................................7-3
Error Conditions...........................................................................................................7-12
.......................................................................................................................7-1
The TCP Library Function Panels....................................................................7-1
TCP Clients and Servers ..................................................................................7-2
The TCP Callback Function.............................................................................7-2
ClientTCPRead ................................................................................................7-3
ClientTCPWrite................................................................................................7-4
ConnectToTCPServer ......................................................................................7-5
DisconnectFromTCPServer .............................................................................7-7
DisconnectTCPClient.......................................................................................7-7
GetTCPErrorString...........................................................................................7-8
RegisterTCPServer...........................................................................................7-8
ServerTCPRead................................................................................................7-10
ServerTCPWrite...............................................................................................7-11
UnregisterTCPServer.......................................................................................7-11
© National Instruments Corporation xi LabWindows/CVI Standard Libraries
Contents
Chapter 8 Utility Library
The Utility Library Function Panels.............................................................................8-1
Utility Library Function Reference..............................................................................8-5
Beep..................................................................................................................8-5
Breakpoint........................................................................................................8-6
CloseCVIRTE ..................................................................................................8-6
Cls ....................................................................................................................8-7
CopyFile...........................................................................................................8-7
CVILowLevelSupportDriverLoaded................................................................8-8
DateStr..............................................................................................................8-9
Delay ................................................................................................................8-9
DeleteDir..........................................................................................................8-10
DeleteFile.........................................................................................................8-10
DisableBreakOnLibraryErrors .........................................................................8-11
DisableInterrupts..............................................................................................8-12
DisableTaskSwitching......................................................................................8-12
EnableBreakOnLibraryErrors ..........................................................................8-15
EnableInterrupts...............................................................................................8-15
EnableTaskSwitching.......................................................................................8-16
ExecutableHasTerminated................................................................................8-16
GetBreakOnLibraryErrors................................................................................8-17
GetBreakOnProtectionErrors ...........................................................................8-18
GetCVIVersion.................................................................................................8-18
GetCurrentPlatform..........................................................................................8-19
GetDir...............................................................................................................8-20
GetDrive...........................................................................................................8-20
GetExternalModuleAddr..................................................................................8-21
GetFileAttrs......................................................................................................8-23
GetFileDate ......................................................................................................8-24
GetFileSize.......................................................................................................8-25
GetFileTime .....................................................................................................8-26
GetFirstFile ......................................................................................................8-27
GetFullPathFromProject ..................................................................................8-29
GetInterruptState..............................................................................................8-30
GetKey .............................................................................................................8-30
GetModuleDir ..................................................................................................8-31
GetNextFile......................................................................................................8-33
GetPersistentVariable.......................................................................................8-33
GetProjectDir ...................................................................................................8-34
GetStdioPort.....................................................................................................8-35
GetStdioWindowOptions.................................................................................8-35
GetStdioWindowPosition.................................................................................8-36
GetStdioWindowSize.......................................................................................8-37
GetStdioWindowVisibility...............................................................................8-37
...................................................................................................................8-1
LabWindows/CVI Standard Libraries xii © National Instruments Corporation
Contents
GetSystemDate.................................................................................................8-38
GetSystemTime................................................................................................8-39
GetWindowDisplaySetting...............................................................................8-39
InitCVIRTE......................................................................................................8-40
inp.....................................................................................................................8-42
inpw..................................................................................................................8-42
InStandaloneExecutable...................................................................................8-43
KeyHit..............................................................................................................8-43
LaunchExecutable............................................................................................8-44
LaunchExecutableEx........................................................................................8-47
LoadExternalModule........................................................................................8-49
LoadExternalModuleEx...................................................................................8-52
MakeDir ...........................................................................................................8-54
MakePathname.................................................................................................8-55
outp...................................................................................................................8-56
outpw................................................................................................................8-56
ReadFromPhysicalMemory..............................................................................8-57
ReadFromPhysicalMemoryEx.........................................................................8-58
ReleaseExternalModule ...................................................................................8-59
RenameFile.......................................................................................................8-60
RetireExecutableHandle...................................................................................8-61
RoundRealToNearestInteger............................................................................8-61
RunExternalModule.........................................................................................8-62
SetBreakOnLibraryErrors ................................................................................8-63
SetBreakOnProtectionErrors............................................................................8-64
SetDir ...............................................................................................................8-66
SetDrive............................................................................................................8-66
SetFileAttrs ......................................................................................................8-67
SetFileDate.......................................................................................................8-68
SetFileTime......................................................................................................8-70
SetPersistentVariable .......................................................................................8-71
SetStdioPort......................................................................................................8-71
SetStdioWindowOptions..................................................................................8-72
SetStdioWindowPosition .................................................................................8-74
SetStdioWindowSize........................................................................................8-75
SetStdioWindowVisibility ...............................................................................8-76
SetSystemDate .................................................................................................8-76
SetSystemTime ................................................................................................8-77
SplitPath...........................................................................................................8-77
SyncWait..........................................................................................................8-79
SystemHelp ......................................................................................................8-79
TerminateExecutable........................................................................................8-82
Timer................................................................................................................8-83
TimeStr.............................................................................................................8-83
TruncateRealNumber .......................................................................................8-84
© National Instruments Corporation xiii LabWindows/CVI Standard Libraries
Contents
UnloadExternalModule....................................................................................8-84
WriteToPhysicalMemory.................................................................................8-85
WriteToPhysicalMemoryEx.............................................................................8-86
Chapter 9 X Property Library
X Property Library Overview.......................................................................................9-1
The X Property Library Function Panels .........................................................9-1
X Interclient Communication...........................................................................9-2
Property Handles and Types ............................................................................9-3
Communicating with Local Applications ........................................................9-3
The Hidden Window........................................................................................9-3
Property Callback Functions............................................................................9-4
Error Codes ......................................................................................................9-4
Using the Library Outside of LabWindows/CVI.............................................9-7
X Property Library Function Reference.......................................................................9-7
ConnectToXDisplay.........................................................................................9-7
CreateXProperty...............................................................................................9-9
CreateXPropType.............................................................................................9-10
DestroyXProperty.............................................................................................9-12
DestroyXPropType...........................................................................................9-13
DisconnectFromXDisplay................................................................................9-14
GetXPropErrorString .......................................................................................9-15
GetXPropertyName..........................................................................................9-15
GetXPropertyType...........................................................................................9-16
GetXPropTypeName........................................................................................9-17
GetXPropTypeSize...........................................................................................9-18
GetXPropTypeUnit ..........................................................................................9-19
GetXWindowPropertyItem ..............................................................................9-20
GetXWindowPropertyValue............................................................................9-22
InstallXPropertyCallback.................................................................................9-25
PutXWindowPropertyItem...............................................................................9-27
PutXWindowPropertyValue.............................................................................9-29
RemoveXWindowProperty..............................................................................9-31
UninstallXPropertyCallback ............................................................................9-33
.........................................................................................................9-1
Chapter 10 Easy I/O for DAQ Library
Easy I/O for DAQ Library Function Overview............................................................10-1
Advantages of Using the Easy I/O for DAQ Library.......................................10-1
Limitations of Using the Easy I/O for DAQ Library .......................................10-2
Easy I/O for DAQ Library Function Panels.....................................................10-2
Device Numbers...............................................................................................10-4
Channel String for Analog Input Functions.....................................................10-4
Command Strings.............................................................................................10-6
LabWindows/CVI Standard Libraries xiv © National Instruments Corporation
...........................................................................................10-1
Contents
Channel String for Analog Output Functions ..................................................10-7
Valid Counters for the Counter/Timer Functions ............................................10-7
Easy I/O for DAQ Function Reference........................................................................10-8
AIAcquireTriggeredWaveforms ......................................................................10-8
AIAcquireWaveforms......................................................................................10-13
AICheckAcquisition.........................................................................................10-15
AIClearAcquisition ..........................................................................................10-15
AIReadAcquisition...........................................................................................10-16
AISampleChannel ............................................................................................10-17
AISampleChannels...........................................................................................10-18
AIStartAcquisition ...........................................................................................10-19
AOClearWaveforms.........................................................................................10-20
AOGenerateWaveforms...................................................................................10-21
AOUpdateChannel...........................................................................................10-22
AOUpdateChannels..........................................................................................10-23
ContinuousPulseGenConfig.............................................................................10-24
CounterEventOrTimeConfig............................................................................10-26
CounterMeasureFrequency ..............................................................................10-29
CounterRead.....................................................................................................10-32
CounterStart .....................................................................................................10-33
CounterStop......................................................................................................10-34
DelayedPulseGenConfig..................................................................................10-34
FrequencyDividerConfig..................................................................................10-37
GetAILimitsOfChannel....................................................................................10-40
GetChannelIndices...........................................................................................10-41
GetChannelNameFromIndex ...........................................................................10-42
GetDAQErrorString.........................................................................................10-43
GetNumChannels.............................................................................................10-44
GroupByChannel..............................................................................................10-44
ICounterControl ...............................................................................................10-45
PlotLastAIWaveformsPopup ...........................................................................10-47
PulseWidthOrPeriodMeasConfig.....................................................................10-48
ReadFromDigitalLine.......................................................................................10-49
ReadFromDigitalPort.......................................................................................10-51
SetEasyIOMultitaskingMode...........................................................................10-53
WriteToDigitalLine..........................................................................................10-53
WriteToDigitalPort...........................................................................................10-55
Error Conditions...........................................................................................................10-57
Appendix A Customer Communication
Glossary Index
© National Instruments Corporation xv LabWindows/CVI Standard Libraries
................................................................................................................................G-1
......................................................................................................................................I-1
.............................................................................................A-1
Contents
Tables
Table 1-1. ANSI C Standard Library Classes .........................................................................1-1
Table 1-2. C Locale Information Values.................................................................................1-3
Table 2-1. The Formatting and I/O Library Function Tree.....................................................2-2
Table 3-1. The Analysis Library Function Tree......................................................................3-1
Table 3-2. Analysis Library Error Codes................................................................................3-37
Table 4-1. The GPIB Functions Library Function Tree..........................................................4-2
Table 5-1. The RS-232 Library Function Tree........................................................................5-1
Table 5-2. PC Cable Configuration.........................................................................................5-4
Table 5-3. DTE to DCE Cable Configuration.........................................................................5-5
Table 5-4. PC to DTE Cable Configuration............................................................................5-5
Table 5-5. Bit Definitions for the GetComStat Function........................................................5-20
Table 5-6. RS-232 Library Error Codes..................................................................................5-36
Table 6-1. DDE Library Function Tree...................................................................................6-1
Table 6-2. DDE Transaction Types (xType)...........................................................................6-4
Table 6-3. DDE Library Error Codes......................................................................................6-24
Table 7-1. The TCP Library Function Tree ............................................................................7-1
Table 7-2. TCP Transaction Types (xType)............................................................................7-3
Table 7-3. TCP Library Error Codes.......................................................................................7-12
Table 8-1. The Utility Library Function Tree .........................................................................8-1
Table 9-1. The X Property Library Function Tree..................................................................9-2
Table 9-2. Predefined Property Types.....................................................................................9-3
Table 9-3. X Property Library Error Types and Descriptions.................................................9-5
Table 9-4. Status Values for InstallXPropertyCallback..........................................................9-26
Table 10-1. Easy I/O for DAQ Function Tree.........................................................................10-2
Table 10-2. Valid Counters.....................................................................................................10-7
Table 10-3. Definition of Am 9513: Counter +1 ....................................................................10-28
Table 10-4. Adjacent Counters................................................................................................10-30
Table 10-5. Easy I/O for DAQ Error Codes............................................................................10-57
LabWindows/CVI Standard Libraries xvi © National Instruments Corporation

About This Manual

The LabWindows/CVI Standard Libraries Reference Manual contains information about the LabWindows/CVI standard libraries—the Graphics Library, the Analysis Library, the Formatting and I/O Library, the GPIB Library, the GPIB-488.2 Library, the RS-232 Library, the Utility Library, and the system libraries. The LabWindows/CVI Standard Libraries Reference Manual is intended for use by LabWindows/CVI users who have already completed the Getting Started with LabWindows/CVI tutorial and are familiar with the LabWindows/CVI User Manual. To use this manual effectively, you should be familiar with LabWindows/CVI and DOS fundamentals.

Organization of This Manual

The LabWindows/CVI Standard Libraries Reference Manual is organized as follows.
Chapter 1, ANSI C Library, describes the ANSI C Standard Library as implemented in LabWindows/CVI.
Chapter 2, Formatting and I/O Library, describes the functions in the LabWindows/CVI Formatting and I/O Library, and contains many examples of how to use them. The Formatting and I/O Library contains functions that input and output data to files and manipulate the format of data in a program.
Chapter 3, Analysis Library, describes the functions in the LabWindows/CVI Analysis Library. The Analysis Library Function Overview section contains general information about the Analysis Library functions and panels. The Analysis Library Function Reference section contains an alphabetical list of the function descriptions.
Chapter 4, GPIB/GPIB-488.2 Library, describes the NI-488 and NI-488.2 functions in the LabWindows/CVI GPIB Library, as well as the Device Manager functions in LabWindows/CVI. The GPIB Library Function Overview section contains general information about the GPIB Library functions and panels, the GPIB DLL, and guidelines and restrictions you should know when using the GPIB Library. Detailed descriptions of the NI-488 and NI-488.2 functions can be found in your NI-488.2 function reference manual. The GPIB Function Reference section contains an alphabetical list of descriptions for the Device Manager functions, the callback installation functions, and the functions for returning the thread-specific status variables.
© National Instruments Corporation xvii LabWindows/CVI Standard Libraries
About This Manual
Chapter 5, RS-232 Library, describes the functions in the LabWindows/CVI RS-232 Library. The RS-232 Library Function Overview section contains general information about the RS-232 Library functions and panels. The RS-232 Library Function Reference section contains an alphabetical list of function descriptions.
Chapter 6, DDE Library, describes the functions in the LabWindows/CVI DDE (Dynamic Data Exchange) Library. The DDE Library Function Overview section contains general information about the DDE Library functions and panels. The DDE Library Function Reference section contains an alphabetical list of function descriptions. This library is available for LabWindows/CVI for Microsoft Windows only.
Chapter 7, TCP Library, describes the functions in the LabWindows/CVI TCP (Transmission Control Protocol) Library. The TCP Library Function Overview section contains general information about the TCP Library functions and panels. The TCP Library Function Reference section contains an alphabetical list of function descriptions.
Chapter 8, Utility Library, describes the functions in the LabWindows/CVI Utility Library. The Utility Library contains functions that do not fit into any of the other LabWindows/CVI libraries. The Utility Library Function Panels section contains general information about the Utility Library functions and panels. The Utility Library Function Reference section contains an alphabetical list of function descriptions.
Chapter 9, X Property Library, describes the functions in the Lab/Windows CVI X Property Library. The X Property Library contains functions that read and write properties to and from X Windows. The X Property Library Overview section contains general information about the X Property Library functions and panels. The X Property Library Function Reference section contains an alphabetical list of function descriptions.
Chapter 10, Easy I/O for DAQ Library describes the functions in the Easy I/O for DAQ Library. The Easy I/O for DAQ Library Function Overview section contains general information about the functions, and guidelines and restrictions you should know when using the Easy I/O for DAQ Library. The Easy I/O for DAQ Library Function Reference section contains an alphabetical list of function descriptions.
Appendix A, Customer Communication, contains forms you can use to request help from National Instruments or to comment on our products and manuals.
The Glossary contains an alphabetical list and description of terms used in this manual, including abbreviations, acronyms, metric prefixes, mnemonics, and symbols.
The Index contains an alphabetical list of key terms and topics in this manual, including the page where you can find each one.
LabWindows/CVI Standard Libraries xviii © National Instruments Corporation

Conventions Used in This Manual

The following conventions are used in this manual:
About This Manual
bold
italic Italic text denotes emphasis, a cross reference, or an introduction to
bold italic Bold italic text denotes a note, caution, or warning.
monospace Text in this font denotes text or characters that you should literally
italic monospace
< > Angle brackets enclose the name of a key. A hyphen between two
Bold text denotes a parameter, menu item, return value, function panel item, or dialog box button or option.
a key concept.
enter from the keyboard. Sections of code, programming examples, and syntax examples also appear in this font. This font also is used for the proper names of disk drives, paths, directories, programs, subprograms, subroutines, device names, variables, filenames, and extensions, and for statements and comments taken from program code.
Italic text in this font denotes that you must supply the appropriate words or values in the place of these items.
or more key names enclosed in angle brackets denotes that you should simultaneously press the named keys–for example, <Ctrl-Alt-Delete>.
» The » symbol leads you through nested menu items and dialog
box options to a final action. The sequence
File » Page Setup » Options » Substitute Fonts
directs you to pull down the item, select option from the last dialog box.
paths Paths in this manual are denoted using backslashes (\) to
separate drive names, directories, and files, as in
drivename\dir1name\dir2name\myfile
IEEE 488, IEEE 488 and IEEE 488.2 refer to the ANSI/IEEE Standard 488.1-1987, IEEE 488.2 and the ANSI/IEEE Standard 488.2-1992, respectively, which define the GPIB.
Abbreviations, acronyms, metric prefixes, mnemonics, symbols, and terms are listed in the
Glossary.
© National Instruments Corporation xix LabWindows/CVI Standard Libraries
Options
, and finally select the
File
menu, select the
Substitute Fonts
Page Setup
About This Manual

The LabWindows/CVI Documentation Set

For a detailed discussion of the best way to use the LabWindows/CVI documentation set, see the section Using the LabWindows/CVI Documentation Set in Chapter 1, Introduction to LabWindows/CVI of Getting Started with LabWindows/CVI.

Related Documentation

The following documents contain information that you may find helpful as you read this manual:
ANSI/IEEE Standard 488.1-1987, IEEE Standard Digital Interface for Programmable
Instrumentation
ANSI/IEEE Standard 488.2-1992, IEEE Standard Codes, Formats, Protocols, and Common Commands
Harbison, Samuel P. and Guy L. Steele, Jr., C: A Reference Manual, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1995.
Nye, Adrian. Xlib Programming Manual. Sebastopol, California: O'Reilly & Associates,
1994. ISBN 0-937175-27-7
Gettys, James and Robert W. Scheifler. Xlib—C Language X Interface, MIT X Consortium Standard. Cambridge, Massachussetts: X Consortium, 1994. ISBN (none)

Customer Communication

National Instruments wants to receive your comments on our products and manuals. We are interested in the applications you develop with our products, and we want to help if you have problems with them. To make it easy for you to contact us, this manual contains comment and technical support forms for you to complete. These forms are in the appendix, Customer
Communication, at the end of this manual.
LabWindows/CVI Standard Libraries xx © National Instruments Corporation

Chapter 1 ANSI C Library

This chapter describes the ANSI C Standard Library as implemented in LabWindows/CVI.
Note:
When you link your executable or DLL with an external compiler, you are using the
ANSI C library of the external compiler.

Table 1-1. ANSI C Standard Library Classes

Class Header File
Character Handling <ctype.h>
Character Testing Character Case Mapping
Date and Time <time.h>
Time Operations Time Conversion
Time Formatting Localization <locale.h> Mathematics <math.h>
Trigonometric Functions
Hyperbolic Functions
Exp and Log Functions
Power Functions Nonlocal Jumping <setjmp.h> Signal Handling <signal.h> Input/Output <stdio.h>
Open/Close
Read/Write/Flush
Line Input/Output
Character Input/Output
Formatted Input/Output
Buffer Control
File Positioning
File System Operations
Error Handling
(continues)
© National Instruments Corporation 1-1 LabWindows/CVI Standard Libraries
ANSI C Library Chapter 1
Table 1-1. ANSI C Standard Library Classes (Continued)
General Utilities <stdlib.h>
String to Arithmetic Expression
Random Number Generation
Memory Management
Searching and Sorting
Integer Arithmetic
Multibyte Character Sets
Program Termination
Environment String Handling <string.h>
Byte Operations
String Operations
String Searching
Collation Functions
Miscellaneous

Low-Level I/O Functions

Under UNIX you can use the low-level I/O functions (such as open, sopen, read, and write) from the system library by including system header files in your program. Under
Windows you can use these functions by including cvi\include\ansi\lowlvlio.h in your program. No function panels are provided for these functions.

Standard Language Additions

LabWindows/CVI does not support extended character sets that require more than 8 bits per character. As a result, the wide character type wchar_t is identical to the single-byte char type. LabWindows/CVI accepts wide character constants specified with the L prefix (as in
L‘ab’), but only the first character is significant. Furthermore, library functions that use the wchar_t type operate only on 8-bit characters.
LabWindows/CVI supports variable argument functions using the ANSI C macros, with one exception: none of the unspecified arguments can have a struct type. As a result, the macro va_arg (ap, type) should never be used when type is a structure.
Note:
Under UNIX, LabWindows/CVI implements only the C locale as defined by the ANSI C standard. The native locale, which is specified by the empty string, "", is also the C locale. The following table shows the locale information values for the C locale.
LabWindows/CVI Standard Libraries 1-2 © National Instruments Corporation
LabWindows/CVI will not warn you about this error.
Chapter 1 ANSI C Library

Table 1-2. C Locale Information Values

Name Type C locale Value Description
decimal_point char * "."
thousands_sep char * ""
grouping char * "" int_curr_symbol char * ""
currency_symbol char * ""
mon_decimal_point char * "" mon_thousands_sep char * ""
mon_grouping char * "" positive_sign char * ""
negative_sign char * ""
int_frac_digits char CHAR_MAX
frac_digits char CHAR_MAX
p_cs_precedes char CHAR_MAX
p_sep_by_space char CHAR_MAX
n_cs_precedes char CHAR_MAX n_sep_by_space char CHAR_MAX
p_sign_posn char CHAR_MAX
n_sign_posn char CHAR_MAX
Decimal point character for non-monetary values.
Non-monetary digit group separator character or characters.
Non-monetary digit groupings. The three-character international currency
symbol, plus the character used to separate the international symbol from the monetary quantity.
The local currency symbol for the current locale.
Decimal point character for monetary values. Monetary digit group separator character or
characters. Monetary digit groupings. Sign character or characters for non-negative
monetary quantities. Sign character or characters for negative
monetary quantities. Digits appear to the right of the decimal point
for international monetary formats. Digits appear to the right of the decimal point
for other than international monetary formats.
currency_symbol
1 if
precedes non-
negative monetary values; 0 if it follows.
currency_symbol
1 if
is separated from non-negative monetary values by a space; else 0.
p_cs_precedes
Like
p_sep_by_space
Like
, for negative values.
, for negative
values. The positioning of
positive_sign
for a
non-negative monetary quantity, then its
currency_symbol
The positioning of
.
negative_sign
for a
negative monetary quantity, then its
currency_symbol
.
© National Instruments Corporation 1-3 LabWindows/CVI Standard Libraries
ANSI C Library Chapter 1
Under Windows, LabWindows/CVI implements the default locale by using the appropriate items from the Intl section of the WIN.INI file and appropriate Microsoft Windows functions. Anything not mentioned here has the same behavior under the default locale as specified in the C locale.
For the LC_NUMERIC locale:
decimal_point maps to the value of sDecimal.
thousands_sep maps to the value of sThousand. For the LC_MONETARY locale:
currency_symbol maps to the value of sCurrency.
mon_decimal_point maps to the value of sDecimal.
mon_thousands_sep maps to the value of sThousand.
frac_digits maps to the value of iCurrDigits.
int_frac_digits maps to the value of iCurrDigits.
p_cs_precedes and n_cs_precedes are set to 1 if iCurrency equals 0 or 2,
otherwise they are set to 0.
p_sep_by_space and n_sep_by_space are set to 0 if iCurrency equals 0 or 1, otherwise they are set to 0.
p_sign_posn and n_sign_posn are determined by the value of iNegCurr as follows:
Value of
Value of iNegCurr
p_sign_posn/n_sign_posn
0, 4 0 1, 5, 8, 9 1 3, 7, 10 2 63 24
For the LC_CTYPE locale:
isalnum maps to the Windows function isCharAlphaNumeric.
isalpha maps to the Windows function isCharAlpha.
LabWindows/CVI Standard Libraries 1-4 © National Instruments Corporation
Chapter 1 ANSI C Library
islower maps to the Windows function isCharLower.
isupper maps to the Windows function isCharUpper.
tolower maps to the Windows function AnsiLower.
toupper maps to the Windows function AnsiUpper.
For the LC_TIME locale:
strftime uses the following items from the WIN.INI file for the appropriate format
specifiers: sTime, iTime, s1159, s2359, iTLZero, sShortDate, and sLongDate.
The names of the weekdays and the names of the months match the language version of LabWindows/CVI. That is, a German version of LabWindows/CVI would use the German names of months and days.
For the LC_COLLATE locale:
strcoll maps to the Windows function lstrcmp.
Because LabWindows/CVI does not support extended character sets that require more than a byte per character, a multibyte character in LabWindows/CVI is actually a single byte character. Likewise, a multibyte sequence is a sequence of single byte characters. Because a multibyte character is the same as a wide character, the conversion functions described in these sections do little more than return their inputs as outputs.

Character Processing

LabWindows/CVI implements all the ANSI C character processing facilities as both macros and functions. The macros are disabled when the LabWindows/CVI debugging level is set to Standard or Extended, so that user protection is available for the arguments to the functions.

String Processing

Under UNIX, the strcoll function is equivalent to strcmp and its behavior is not affected by the LC_COLLATE locale. Under Windows, strcoll is equivalent to the Windows function lstrcmp. For both platforms, the function strxfrm performs a string copy using strncpy and returns the length of its second argument.
© National Instruments Corporation 1-5 LabWindows/CVI Standard Libraries
ANSI C Library Chapter 1

Input/Output Facilities

The function rename fails if the target file already exists. Under Microsoft Windows, rename fails if the source and target files are on different disk drives. Under UNIX, rename fails if the source and target files are on different file systems.
The functions fgetpos and ftell set errno to EFILPOS on error.

errno Set by File I/O Functions

The errno global variable is set to indicate specific error conditions by the ANSI C file I/O functions and the low-level I/O functions. The possible values of errno are declared in cvi\include\ansi\errno.h. There is a base set of values that is common to all platforms. There are additional values that are specific to particular platforms.
Under Windows 3.1, errno gives very limited information. If the operating system returns an error, errno is set to EIO.
Under Windows 95 and NT, you can call the Windows SDK GetLastError function to obtain system specific information when errno is set to one of the following values:
EACCES EBADF EIO ENOENT ENOSPC

Mathematical Functions

The macro HUGE_VAL defined in the header math.h as well as the macros FLT_EPSILON, FLT_MAX, FLT_MIN, DBL_EPSILON, DBL_MAX, DBL_MIN, LDBL_EPSILON, LDBL_MAX,
and DBL_MIN defined in the header float.h all refer to variables. Consequently, these macros cannot be used in places where constant expressions are required, such as in global initializations.

Time and Date Functions

Function time returns the number of seconds since January 1, 1990. Functions mktime and localtime require time zone information to produce correct results.
LabWindows/CVI obtains time zone information from the environment variable named TZ, if it exists. The value of this variable should have the format AAA[S]HH[:MM]BBB, where optional items are in square brackets.
LabWindows/CVI Standard Libraries 1-6 © National Instruments Corporation
Chapter 1 ANSI C Library
The AAA and BBB fields specify the names of the standard and daylight savings time zones, respectively (such as EST for Eastern Standard Time and EDT for Eastern Daylight Time). The optional sign field S indicates whether the local time zone is to the west (+) or to the east (-) of UTC (Greenwich Mean Time). The hour field (HH) and the optional minutes field (:MM) specify the number of hours and minutes from UTC. As an example, the string EST05EDT specifies the time zone information for the eastern part of the United States.
The functions gmtime, localtime, and mktime make corrections for daylight savings time (DST). LabWindows/CVI uses a set of rules for determining when daylight savings time begins and ends. A string in the messages file cvimsgs.txt in the LabWindows/CVI bin directory specifies these rules. The following is the default value of this string.
":(1986)040102+0:110102-0:(1967)040102-0:110102-0" This states that for the years from 1986 to the present, DST begins at 2:00 a.m. on the first
Sunday in April, and ends at 2:00 a.m. on the last Sunday in October. For the years from 1967 to 1985, DST begins at 2:00 a.m. on the last Sunday in March, and ends at 2:00 a.m. on the last Sunday in October. You can change the way LabWindows/CVI determines DST by changing this string in the cvimsgs.txt file. The countmsg.exe program must be executed after changing the text file. You should execute the following line.
countmsg cvimsgs.txt

Control Functions

The assert macro defined by LabWindows/CVI does not print diagnostics to the standard error stream when the debugging level is anything other than None. Instead, when the value of its argument evaluates to zero, LabWindows/CVI will display a dialog box with a message containing the file name, line number, and expression that caused the assert to fail.
Under UNIX, system passes the specified command to the Bourne shell (sh) as input, as if the current process was performing a wait(2V) system call and was waiting until the shell terminated. Callbacks are not called while the command is executing.
Under Windows, the executable can be either an MS DOS or Microsoft Windows executable, including *.exe, *.com, *.bat, and *.pif files. The function does not return until the command terminates, and user keyboard and mouse events are ignored until the command exits. Callbacks for asynchronous events, such as idle events, Windows messages, and VXI interrupts, PostDeferredCall calls, and DAQ events are called while the command is executing. If you need to execute a command built into command.com such as copy, dir, and others, you can call system with the command command.com /C DosCommand args, where DosCommand is the shell command you would like executed. Refer to your DOS documentation for further help with command.com. DOS executables (.exe, .com, and .bat files) use the settings in _default.pif (in your Windows directory) when they are running. You can change their priority, display options, and more by editing _default.pif
© National Instruments Corporation 1-7 LabWindows/CVI Standard Libraries
ANSI C Library Chapter 1
or by creating another .pif file. Refer to your Microsoft Windows documentation for help on creating and editing .pif files.
If the function is passed a null pointer, LabWindows/CVI returns a non zero value if a command processor is available. Under UNIX, if the argument is not a null pointer, the program returns a zero. Under Microsoft Windows, if the argument is not a null pointer, the program returns zero if the program was successfully started, otherwise it returns one of the following error codes.
-1 System was out of memory, executable file was corrupt, or relocations were invalid.
-3 File was not found.
-4 Path was not found.
-6 Attempt was made to dynamically link to a task, or there was a sharing or network protection error.
-7 Library required separate data segments for each task.
-9 There was insufficient memory to start the application.
-11 Windows version was incorrect.
-12 Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image.
-13 Application was designed for a different operating system.
-14 Application was designed for MS-DOS 4.0.
-15 Type of executable file was unknown.
-16 Attempt made to load a real-mode application (developed for an earlier Windows version.)
-17 Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only.
-20 Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded.
-21 Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt.
-22 Application requires Microsoft Windows 32-bit extensions.
-23 Could not find toolhelp.dll or toolhelp.dll is corrupted.
-24 Could not allocate a GetProcUserDefinedHandle.
The exit function does not actually flush and close the open streams. LabWindows/CVI leaves files open so that they may be used from within the Interactive Window after execution of the project terminates. The Close Libraries menu option under the Run menu performs this library cleanup. This library cleanup is also performed when you restart execution of the project by selecting Run Project from the Run menu. The argument passed to function exit is not used by the LabWindows/CVI environment. Under UNIX, standalone executables created by LabWindows/CVI return the value of the argument passed to the exit function.
LabWindows/CVI Standard Libraries 1-8 © National Instruments Corporation
Chapter 1 ANSI C Library
The UNIX version of LabWindows/CVI works with all the signals supported by UNIX in addition to the ANSI C signals.

ANSI C Library Function Reference

For ANSI C function descriptions, consult a reference work such as C: A Reference Manual which is listed in the Related Documentation section of About This Manual. Alternatively, you can use LabWindows/CVI function panel help. The following function description is provided because it is an extension of the ANSI C function set.

fdopen

FILE *fp =
Note:
This function is available only in the Windows version of LabWindows/CVI.
Purpose
You can use this function to obtain a pointer to a buffered I/O stream from a file handle returned by one of the following functions.
open (low-level I/O) sopen (low-level I/O)
You can use the return value just as if you had obtained it from fopen. (Although this function is not in the ANSI standard, it is included in this library because it
returns a pointer to a buffered I/O stream.)
Parameters
Input
fdopen
fileHandle mode
fileHandle
(int
integer File handle returned by open or sopen. string Specifies the read/write, binary/text, and append modes.
, char *
mode
);
Return Value
fp
Return Codes
NULL (0)
© National Instruments Corporation 1-9 LabWindows/CVI Standard Libraries
Failure. More specific information is in errno.
FILE *
Pointer to a buffered I/O file stream.
ANSI C Library Chapter 1
Parameter Discussion mode is the same as the mode parameter to fopen.
You should use a mode value that is consistent with the mode in which you originally opened the file. If you use write capabilities that were not enabled when the file handle was originally opened, the call to fdopen succeeds, but any attempt to write fails. For instance, if you originally opened the file for reading only, you can pass "rw" to fdopen, but any call to fwrite fails.
LabWindows/CVI Standard Libraries 1-10 © National Instruments Corporation
Loading...
+ 424 hidden pages