| | |
converting string[][] to float[]
![]() |
•
•
Join Date: Oct 2007
Posts: 41
Reputation:
Solved Threads: 0
I am trying to convert some data that I read in file as string data to a float array
The data that is read are in two dimensional string array like
Now I need to convert the content of tmatrix[][] into a float array
so that float_array[1]=0.5
The data that is read are in two dimensional string array like
C Syntax (Toggle Plain Text)
char tmatrix[10][100]; for(j=0;j<k3;j++){printf("\n %s",tmatrix[j]);} //k3=max data read 0.5 0.2 0.3 0.6
Now I need to convert the content of tmatrix[][] into a float array
so that float_array[1]=0.5
No problem -- just call atof()
Not a perfrect solution, but works ok for most purposes.
C Syntax (Toggle Plain Text)
float n = atof(tmatrix[i]);
Not a perfrect solution, but works ok for most purposes.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- string to float (C)
- Converting String to Integer help (C++)
- Converting String* to char* (C)
- cannot convert from 'double' to 'float [6][3]' (C)
Other Threads in the C Forum
- Previous Thread: Yet another ATM post (split from the dead)
- Next Thread: double and float......
| Thread Tools | Search this Thread |
* adobe ansi api array asterisks binarysearch calculate centimeter changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory feet fflush fgets file fork forloop frequency function givemetehcodez grade graphics gtkgcurlcompiling gtkwinlinux hacking highest histogram i/o inches infiniteloop input intmain() iso kernel keyboard km linked linkedlist linux linuxsegmentationfault list locate looping loopinsideloop. lowest match microsoft mqqueue mysql number oddnumber odf open opendocumentformat owf pattern pdf performance posix probleminc process program programming radix recv recvblocked repetition research reversing scanf scheduling segmentationfault send sequential socket socketprograming stack standard string systemcall threads turboc unix user variable voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi






