02-25-2019 09:57 AM
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.
02-25-2019 08:37 PM
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
02-26-2019 04:37 AM
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
02-26-2019 04:48 AM
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
02-26-2019 06:16 AM
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.
02-28-2019 08:39 AM - edited 02-28-2019 08:46 AM
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.
02-28-2019 09:13 PM
Sir i m waiting for your reply
02-28-2019 11:48 PM
hi sir r u bzy today? i m waiting for your reply kindly reply me with detail explanation
03-01-2019 02:51 AM
As you may imagine, I'm not constantly on the forums, I have to spend some time doing my job
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!