I am a newer to C++, Now what I am going to do is creating a file, and write int values into it Then I want to get those int values with get function!(Here the excepted type of return is int ) Actually this is an index file, so what I am going to put into it are all int values! But I found that both fstream.put and fstream.get could only operate char values. So is there anyone would like to help me, how to do my job. And here is my code
vector<int> tra1;
vector<int> tra2;
int last_capa = 0;
for(int i=1;i<97;i++){
output.put(tra1[i-1] * 5 + tra2[i-1] + last_capa);
last_capa += (tra1[i-1] - 1) * 5 + tra2[i - 1];
}
Below is the code to read int Here I try to get an int number to operate
vector<int> tra4
output.seekg(100);
unsigned int n = output.get() + tra4[2];
Thanks for your help
Haoran