08-30-2009 10:14 AM
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.
08-31-2009 01:48 AM
08-31-2009 05:29 AM
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.
08-31-2009 05:59 AM
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
08-31-2009 06:10 AM
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);
08-31-2009 06:35 AM
- 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
08-31-2009 06:37 AM
08-31-2009 07:29 AM
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
08-31-2009 07:46 AM
08-31-2009 07:50 AM