Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<iomanip>
- #include<sstream>
- using namespace std;
- int main(int argc, char** argv)
- {
- if(argc!=3)
- {
- fprintf(stderr,"Usage: %s\n(1)Input_filename\n(2)Output_filename\n",argv[0]);
- //exit(1);
- }
- ifstream ifs(argv[1]);
- ofstream ofs(argv[2]);
- string line;
- cout << "now converting....wait for a short time" <<endl;
- while(getline(ifs,line))
- {
- float x,y,z;
- int r,g,b;
- int r_down,g_down,b_down;
- istringstream is(line);
- is >> x >> y >> z >> r >> g >> b;
- r_down=r/255;
- g_down=g/255;
- b_down=b/255;
- //cout<< x <<" "<< y <<" "<<z<<" "<<r_down<<" "<<g_down<<" "<< b_down<<endl;
- ofs<< x <<" "<< y <<" "<<z<<" "<<r_down<<" "<<g_down<<" "<< b_down<<endl;
- }
- ifs.close();
- ofs.close();
- cout << "finished" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment