Hi I want to read data from a VTK file into my C++ program. Here is how my files will typically look.
POINTS 2 double
1 2
You could try some code that looks like this. It's kind of a combo of C and C++:
int main ()
{
//assuming that you've completely read in the file to a char* called myFileContents
char * token;
token = strtok (myFileContents," ");
while (token != NULL)
{
istringstream iss( token );
int readInData;
readInData << iss;
if(!iss){
//this means that the data wasn't numeric so don't do anything with it
}
else{
//data was numeric, store it how ever you want
}
token = strtok (NULL, " ");
}
return 0;
}