ifstream input("test.txt"); //put your program together with thsi file in the same folder.
if(input.is_open()){
while(!input.eof()){
string number;
int data;
getline(input,number); //read number
data = atoi(number.c_str()); //convert to integer
cout<<data<<endl; //print it out
}
}
i use matlab to get the data.....after that i write the data in text file.......now i want read the data one by one and process the data using c++?
if i have text file name......"test.txt"...........in the text file have data.
may anyone help me to read the data one by one.......i want to process all the data one by one......please help me.........
its that my program correct or not?
if wrong......may anyone help me to correct it........:(
i get the data from matlab.....afterthat i write the data in the text file name......"test.txt"...........in the text file have data such as:-
0
1
2
in "test.txt", i have 1 row and 3 column.......i want process the data in c++.......i want process the data one by one......if anyone can help me.....:(
im just beginner in this field.....:(
i create the program below to read and process the data.......
its that my program correct or not?
if wrong......may anyone help me to correct it........:(
You're trying to set the value of posx[i][0] to be the same as test[i][1] - but test[i][1] does not exist! What is it meant to be? What are you trying to do here?
I want to take data from "test.text" one by one and put the data in the array posx and at the same time I want to process the data.actually that's what I want to do.....anyone can help me.......urgent......:(