LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Readline example?

Solved!
Go to solution

where can i get readline example program(simple program will do)?

 

my objective is to read one data(number) from the file and and add number and save on other file.

 

first i need to know how to readline. 

 

-Is there any example or advice related to the above to share with me to ease my
writing?

 

Thanks

0 Kudos
Message 1 of 6
(5,627 Views)

... what kind of example? I use it as    

 

bytes_read = ReadLine ( file_handle, line_buffer, maximum_bytes );

but this information can also be found in the help...

 

in the next step you will need to extract your number, e.g. using

 

sscanf ( line_buffer, "%lf", &y [ index ] );

 

As a general comment, it would be nice if you could acknowledge help provided, e.g. by giving kudos or marking the appropriate answer as solution, see e.g. your earlier posts here or here

0 Kudos
Message 2 of 6
(5,620 Views)

Thanks for the advice.

 

i try display it on the debugprintf %s or on indicator display, since like im getting ASCII char. how to display what i see on the file

 

Do we need any conversion of the data type

 

thanks 

0 Kudos
Message 3 of 6
(5,603 Views)

@chris_chua wrote:

...since like im getting ASCII char...


I do not understand... your objective was to read one number from a file, does it work?

 

Did you convert the text string to a number as shown above using sscanf? If so you can display this number using SetCtrlVal (,,) on a numeric display. , otherwise you can display it (also using SetCtrlVal) on a string control...

 

If you are not familiar with CVI controls you may consider reading the Getting Started with CVI manual, see here

0 Kudos
Message 4 of 6
(5,591 Views)

ya im using SetCtrlVal but when i run the program there is error:

 

" NON FATAL RUN-TIME ERROR"

Too Many argument to variable argument function

 

What this error mean? and how to solve this error

 

thanks

 

0 Kudos
Message 5 of 6
(5,587 Views)
Solution
Accepted by topic author chris_chua

I told you about the getting started manual, you need to read it yourself. You also need to get used to using the help of CVI...

 

1) There is a list of run-time errors and warnings, for example here, which tells you that you passed more arguments to the variable argument function than it expected.

 

2) SetCtrlVal is not a function with a variable number of arguments, it has three, so the error happens on a different function, you need to check the line number of the error message and look at the respective line of your code... I guess it's a formatting function such as sscanf...

 

3) The solution also is obvious: open the help on the respective function to see what parameters are expected...

 

4) We don't have the second sight, so in order to assist you better you will need to provide your erroneous code

 

5) Since the initial topic of ReadLine seems to have been solved, mark the solution and open a new thread with a new question

Message 6 of 6
(5,583 Views)