LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

string search

Help!
 
I am trying to do the follwoing...
 
I am quering test Equipment to validate modules.
 
the string's name is "RETURNEDDATA" it is a ViChar
 
the recieved string is "HEWLET-PACKARD, 34904A,0,1,0"
 
which function do I use?
 
I've tried the strstr(RETURNEDDATA, "34904A"), what does this do?
Also, there a document that describes all functions? The header file doesn't and I feel I am not using CVI to its full potential...
 
0 Kudos
Message 1 of 3
(3,320 Views)

Hi, there are a couple of ways to search for a substring; strstr is a standard  C command whose usage you can find in any C manual in the market (unfortunately it's several years that CVI does not ship with Kernigham & Richie manual - or Harbison & Steele one, I don't remember exactly).

Alternative ways could be to use FindPattern instruction or some Scan function with proper modifiers in format string. You can find a full explanation of the latter in the online help for the Formatting and I/O Library, that comes with an exahustive set of examples.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,307 Views)
CVI used to deliver with Harbison & Steele.  Still an excellent book - compiler writers know a langauge the best.  I use my copy every day that I write C code.  ISBN 0-13-0895292-X.

You can also use the regular expression "instrument" (function panel) in the CVI toolslib toolbox folder.

Regular expressions can be used to find anything, if you're able to come up with the appropriate expression describing what you're looking for.  And it does take some time to learn how to use regexp's.  There's a good O'Reilly book on regexps, "Mastering Regular Expressions".  The NI regular expression instrument is not as complete as the regexpr facilities built into some langauges like Java.

As it turns out, the standard C string format descriptors have a kind of regular expression format descriptor available, the "[" format descriptor.  C scanning functions will scan past leading white space which often helps you find stuff too.

Menchar
0 Kudos
Message 3 of 3
(3,259 Views)