LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

r

Im a lil stuck on this problem. I know howto read the second line of the text file.  but i cant seem all the lines of the text file. basically im settting my gui numbers

 

from the text file, and when i hit the update button all of the switches will insert from the text file. i got one to work.i having a problem of getting all the lines to insert.

 

i need a little assistance.

0 Kudos
Message 1 of 11
(4,523 Views)
I do not understand the topic nor the description...
0 Kudos
Message 2 of 11
(4,513 Views)

ok I have a gui. my gui has 5 switches and a attenuator.

 

next. my gui already has also 6 numeric boxes that comes on along with the  5 switches and a attenuator.

 

what my gui is already doing is if u enter a number from 1-5 in either of the five switches  it will print out a bit.

 

example if i enter 3 from the numeric box it will  display in a string box 00000100. 

 

the same concept  for the the attenuator, but the attenuator is printing binary numbers from 1 -64.

 

this is what my gui is currently doing so far.

 

now my task at hand.

 

i have a text file.

 

this is exactly how my text file looks

 

MMW_CHASSIS_SW1 5

MMW_CHASSIS_sw2 3

MMW_CHASSIS_sw3 1

MMW_CHASSIS_sw4 2

MMW_CHASSIS_sw5 4


MMW_CHASSIS_ATTN 23

 

all im trying to do is parse each line from my text file in my code. I want to be able to just go to the text box and change the numbers

 

that already exist at anytime and get them to display in my numeric box when i hit the update button.

 

so i already know how to open the text file and read  the file. I get lost when i try to  parse switch 2 and on down. I dont know what im doing wrong.

 

so now if i hit the update button the 5 will go to the box. but trying to to do the same from switch2 on down is where im getting lost.

0 Kudos
Message 3 of 11
(4,506 Views)

it appears that you call the line

 

f1=fopen("DEMO_MMW_CHASSIS.txt","r")

 

several times... but you only need to open your file once for reading, and then simply continue reading until the end - opening the file resets the file pointer to the beginning.

 

Wolfgang

0 Kudos
Message 4 of 11
(4,503 Views)

can you give an example, explain a lil more.  im more of a visual person.

 

I don know to  parse the character im trying to find which is the easy way below i just paster. but im trying to do it the way you just mention.

 

so can you copy an example so i can actually see what you are talking about.

 

VARIABLE_HOLDER[36] = NULL;

  CHANGE_CHAR_TO_INTERGER = atoi(&VARIABLE_HOLDER[35]);

  SetCtrlVal(panelHandle, PANEL_NUMERIC_2,CHANGE_CHAR_TO_INTERGER);  
   

0 Kudos
Message 5 of 11
(4,501 Views)

- open file

- scan one line

- scan next line

- scan next line...

- close file

 

for scanning one line of the text file you could use the function  

bytes_read = ReadLine ( file_handle, line_buffer, maximum_bytes );

 

In the next step, you could analyse your text line, e.g. using the function Scan (line_buffer, %s%d);

 

Good luck

0 Kudos
Message 6 of 11
(4,499 Views)
of course, it should read Scan (line_buffer, "%s%d"), sorry;
0 Kudos
Message 7 of 11
(4,497 Views)

thats what i was lokkin for . how to scan the next line. i couldnt find the command or function to do it. lololololol

 

a lil on the slow bus this morning. Im going to change my code up to that way. because i just manually parse it aand got it to work that way.

 

by printing from the elements of the array.

 

 

thanks im getting ready to try it out out in a few

0 Kudos
Message 8 of 11
(4,493 Views)
i cant get it to scan the next line . I need help scanning the next line
0 Kudos
Message 9 of 11
(4,488 Views)
my problem is scanning the nextline
0 Kudos
Message 10 of 11
(4,487 Views)