This is my second time posting here and I need help from you all again.
I don't know how should I search in this forum about my case, so I guess I might just make a thread instead. Please kindly link me to any similar problem in this thread if you spot one.
Here's the problem.
Say, I have this string
I want to make it intoCode:2.56942078E+00-8.59741137E-05 4.19484589E-08 3.28253784E+00 1.48308754E-03-7.57966669E-07
strtok doesn't work because I don't have a consistent delimiter (sometimes it's -, sometimes it's space) in between them.Code:2.56942078E+00 -8.59741137E-05 4.19484589E-08 3.28253784E+00 1.48308754E-03 -7.57966669E-07
I tried using strncpy,
where buff is the string, and the temp and temp2 is what I want to copy into.Code:strncpy(temp,&buff[i],15); strncpy(temp2,&buff[i],15);
It sounds correct to me, but it doesn't do the work.
That part of the code produces:
for temp and temp2 respectively.Code:2.56942078E+00 8.59741137E-05 3.28253784E+00 1.48308754E-03-
That is in fact to my surprise, as I was thinking of using &buff[i] to get my second decimals starting from the 16th character, but instead by trial and error, it's closer to use &buff[i], but that's actually reading from the 17th character of the string.
How could I solve this?