| | |
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 api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h






