LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Read csv textfile and use its somedata

The first field is a text one, right? In a text a comma is a valid character as well as semicolons, periods,  spaces and even numbers: which one is the function expected to interpret as end of field? The answer is in the documentation for the t specifier in case of scanning strings.



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?
Message 11 of 19
(1,286 Views)

Thanku very much respected sir. i will try to do my task today i will find some problem i will discuss with u. but thanks for ur sweet coperation and precious time. May God help u in every field and give u all the right things

0 Kudos
Message 12 of 19
(1,279 Views)

hi sir one phase of the task i have understood now that how to use scan function. Sir now my second phase of task. kindly when i read the attached file by using read line function it reads from the ist line of file. i dont want to read ist line of the text file or ist row of the text file then how to use read line. means i want to start read from second line.

secondly from every line i want to extract particular values for example

title,2,p4,25.5,result,26.5

name,1,p5,24.3,result,23

in above lines i want to extract from ist line 2 and 25.5 and result

similarly in second line i want to extract 1 and 24.3 and result

sir basicly i have to read file and from file after reading every line i will transmit some data. in transmit data each line have particular values which i explain u above. so thats why i dnt want to read or use ist top line. kindly give me explanation in detail. i hope u have understand my question

 

0 Kudos
Message 13 of 19
(1,274 Views)

hi sir. i have one more query suppose a text file have 10 rows and i want to read just 3rd and 5th row how i will read from readline function. kindly give me detail

0 Kudos
Message 14 of 19
(1,271 Views)

You cannot tell ReadLine to start in a particular place in a file, so... simply read the line you don't want to use and ignore them!

As per you second question, Scan include the option of discarding an element scanned (look for d modifier in the help), so you can tailor your scanning function so that it extracts only the fields of interest.



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 15 of 19
(1,268 Views)

hi sir i have understand much of the things. now i m moving forward to my task. sir i have an array of unsigned char transmitpkt[8];

in this array transmitpk[4] is the value of title in msg

and transmitpk[5] is the sequence from msg. sir scan function converts string in to string and string into integers etc. is scan extracts p from msg as unsigned char and similarly 1 from msg as a unsigned char. means i want 1 byte data of title as well as sequence so that i can put it in to array and send it

strcpy (msg, "p,1,p4,25.5,26.5,,");
i want to extract p as a unsigned char and 1 as a unsigned char. kindly write a code how to do that.

 

0 Kudos
Message 16 of 19
(1,251 Views)

Sir i m waiting for your reply

0 Kudos
Message 17 of 19
(1,232 Views)

hi sir r u bzy today? i m waiting for your reply kindly reply me with detail explanation

0 Kudos
Message 18 of 19
(1,225 Views)

As you may imagine, I'm not constantly on the forums, I have to spend some time doing my job Smiley Wink

You may have missed some lessons from your teacher, as I can't believe you don't know hot to copy a byte from a string to another! I'm not going to do the homework for you, go and read your C manual and solve this by yourself!



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?
Message 19 of 19
(1,222 Views)