LabWindows/CVI
Standard Libraries
Reference Manual
Standard Libraries Reference Manual
February 1998 Edition
Part Number 320682D-01
Internet Support
E-mail: support@natinst.com
FTP Site: ftp.natinst.com
Web Address: http://www.natinst.com
Bulletin Board Support
BBS United States: 512 794 5422
BBS United Kingdom: 01635 551422
BBS France: 01 48 65 15 59
Fax-on-Demand Support
512 418 1111
Telephone Support (USA)
Tel: 512 795 8248
Fax: 512 794 5678
International Offices
Australia 03 9879 5166, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Brazil 011 288 3336,
Canada (Ontario) 905 785 0085, Canada (Québec) 514 694 8521, Denmark 45 76 26 00, Finland 09 725 725 11,
France 01 48 14 24 24, Germany 089 741 31 30, Hong Kong 2645 3186, Israel 03 6120092, Italy 02 413091,
Japan 03 5472 2970, Korea 02 596 7456, Mexico 5 520 2635, 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,
United Kingdom 01635 523545
National Instruments Corporate Headquarters
6504 Bridge Point Parkway Austin, Texas 78730-5039 USA Tel: 512 794 0100
© Copyright 1994, 1998 National Instruments Corporation. All rights reserved.
Important Information
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
, N
ATIONAL
I
NSTRUMENTS
MAKES
NO
WARRANTIES
,
EXPRESS
OR
IMPLIED
,
AND
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
N
ATIONAL
I
NSTRUMENTS
SHALL
BE
LIMITED
TO
THE
AMOUNT
THERETOFORE
PAID
BY
THE
CUSTOMER
. N
ATIONAL
I
NSTRUMENTS
WILL
NOT
BE
LIABLE
FOR
DAMAGES
RESULTING
FROM
LOSS
OF
DATA
,
PROFITS
,
USE
OF
PRODUCTS
,
OR
INCIDENTAL
OR
CONSEQUENTIAL
DAMAGES
,
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
CVI
™
, natinst.com
™
, National Instruments
™
, NI-488
™
, NI-488.2
™
, NI-488.2M
™
, NI-DAQ
™
, the CVI logo, the
National Instruments logo, and The Software is the Instrument
™
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.
©
National Instruments Corporation v Standard Libraries Reference Manual
Contents
About This Manual
Organization of This Manual........................................................................................xxv
Conventions Used in This Manual................................................................................xxvii
LabWindows/CVI Documentation Set.........................................................................xxviii
Related Documentation.................................................................................................xxviii
Customer Communication............................................................................................xxix
Chapter 1
ANSI C Library
Low-Level I/O Functions..............................................................................................1-2
Standard Language Additions.......................................................................................1-3
Character Processing.....................................................................................................1-6
String Processing ..........................................................................................................1-6
Input/Output Facilities ..................................................................................................1-6
File I/O Functions Set errno..........................................................................................1-7
Mathematical Functions................................................................................................1-7
Time and Date Functions..............................................................................................1-7
Configuring the DST Rules String.................................................................1-8
Modifying the DST Rules String....................................................................1-8
Suppressing Daylight Savings Time................................................1-9
Starting Year in Daylight Savings Time..........................................1-9
Control Functions .........................................................................................................1-9
ANSI C Library Function Reference............................................................................1-11
fdopen.............................................................................................................1-12
Chapter 2
Formatting and I/O Library
Formatting and I/O Library Function Overview...........................................................2-1
Formatting and I/O Library Function Panels..................................................2-1
Class and Subclass Descriptions ....................................................................2-3
String Manipulation Functions.......................................................................2-3
Special Nature of the Formatting and Scanning Functions............................2-3
Formatting and I/O Library Function Reference..........................................................2-4
ArrayToFile....................................................................................................2-5
CloseFile.........................................................................................................2-8
CompareBytes ................................................................................................2-9
CompareStrings..............................................................................................2-11
CopyBytes ......................................................................................................2-13
Contents
Standard Libraries Reference Manual vi
©
National Instruments Corporation
CopyString..................................................................................................... 2-14
FileToArray.................................................................................................... 2-15
FillBytes......................................................................................................... 2-18
FindPattern..................................................................................................... 2-19
Fmt ................................................................................................................. 2-21
FmtFile........................................................................................................... 2-23
FmtOut ........................................................................................................... 2-24
GetFileInfo..................................................................................................... 2-25
GetFmtErrNdx ............................................................................................... 2-26
GetFmtIOError............................................................................................... 2-27
GetFmtIOErrorString..................................................................................... 2-28
NumFmtdBytes.............................................................................................. 2-29
OpenFile......................................................................................................... 2-30
ReadFile ......................................................................................................... 2-32
ReadLine........................................................................................................ 2-34
Scan................................................................................................................ 2-36
ScanFile.......................................................................................................... 2-38
ScanIn............................................................................................................. 2-40
SetFilePtr........................................................................................................ 2-42
StringLength................................................................................................... 2-44
StringLowerCase............................................................................................ 2-45
StringUpperCase............................................................................................ 2-46
WriteFile ........................................................................................................ 2-47
WriteLine ....................................................................................................... 2-49
Using the Formatting and Scanning Functions ............................................................ 2-50
Introductory Formatting and Scanning Examples ......................................... 2-50
Formatting Functions..................................................................................... 2-51
Formatting Functions—Format String ............................................ 2-51
Formatting Modifiers....................................................................... 2-54
Fmt, FmtFile, FmtOut—Asterisks (*) Instead of
Constants in Format Specifiers..................................................... 2-61
Fmt, FmtFile, FmtOut—Literals in the Format String.................... 2-61
Scanning Functions........................................................................................ 2-62
Scanning Functions—Format String ............................................... 2-62
Scanning Modifiers.......................................................................... 2-66
Scan, ScanFile, ScanIn—Asterisks (*) Instead of
Constants in Format Specifiers..................................................... 2-74
Scan, ScanFile, ScanIn—Literals in the Format String................... 2-75
Formatting and I/O Library Programming Examples .................................................. 2-75
Fmt/FmtFile/FmtOut Examples in C ............................................................. 2-76
Integer to String............................................................................... 2-76
Short Integer to String ..................................................................... 2-77
Real to String in Floating-Point Notation........................................ 2-78
- 1
- 2
- 3
前往页