资源描述:
《[计算机]lab windowscvi实例》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、LabWindows/CVI教程(5)文件和端口操作主讲:乔立岩Email:qiaoliyan@hit.edu.cn(交作业)MSN:qiaoliyan@msn.com(在线交流)Tel:86413532ext.8611(逸夫楼611)字符串操作FormattingandI/O-StringManipulationStringLengthintStringLength(charString[]);i=StringLength(str);StringLowerCasevoidStringLowerCase(charString[]
2、);StringLowerCase(str);StringUpperCaseCompareStringintCompareStrings(charString_#1[],intString_#1_Index,charString_#2[],intString_#2_Index,intCase_Sensitive?);i=CompareStrings(str1,ind1,str2,ind2,0);CopyString……8/25/2021Programmer’sToolbox-StringHandlingAppendStringi
3、ntAppendString(charPointer_To_String_To_Append_To,constcharString_To_Append[],intNum_Characters_To_Append);AppendString(str1,str2,-1);StrDupcharStrDup(constcharString_To_Duplicate[]);str=StrDup("virtualinstrumentationlesson");RemoveSurroundingWhiteSpacevoidRemoveSurr
4、oundingWhiteSpace(charString[]);RemoveSurroundingWhiteSpace(str);SkipWhiteSpaceStrICmpWithoutSurrWhiteSpace……8/25/2021数据格式化(DataFormatting)Fmt将一个或多个源数据(item)格式化到一个目标数据变量中intFmt(voidTarget,charFormat_String[],...);Fmt(str,"%s<%d%s%d",i,"plus",j);Scan将一个源数据(item)格式化到一个
5、或多个目标数据变量中intScan(voidSource,charFormat_String[],...);Scan("10","%s>%d",&i);格式符%s字符串%d,%i整型%f浮点型%10f浮点型数组8/25/2021修饰符修饰符:[wn],[tn],[t#],[pn],[bn]……举例intiData[100];floatfData[100];Fmt(iData,”%100d<%100f”,fData);Fmt(string,"%s<%s%f[p2]","valueis",value);Scan(string,"%s
6、>%s[t#]%f",str1,&value);Fmtwizard8/25/2021定时/等待(Timer/Wait)TimerdoubleTimer(void)DelayvoidDelay(doubleNumber_of_Seconds);Delay(3.0);SyncWaitvoidSyncWait(doubleBegin_Time,doubleInterval);SyncWait(mark,interval);日期/时间(Date/Time)DateStrcharDateStr(void);格式:MM-DD-YYYYTim
7、eStrcharTimeStr(void);格式:HH:MM:SSGetSystemTimeintGetSystemTime(intHours,intMinutes,intSeconds);8/25/2021文件应用Utilities-FileUtilitiesDeleteFileintDeleteFile(charFile_Name[]);i=DeleteFile(".doc");RenameFileintRenameFile(charExisting_File_Name[],charNew_File_Name[]);i=Re
8、nameFile("test1.dat","test2.dat");CopyFileintCopyFile(charSource_File_Name[],charTarget_File_Name[]);i=CopyFile(“test1.dat”,“test2.