Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int GetAllFileWeights(char * GFWname )
- {
- int wread;
- string line;
- ifstream myfile;
- //.
- myfile.open (GFWname, ios::in);
- if (myfile.is_open())
- {
- wread = 0;
- while ( getline (myfile,line) )
- {
- if( wread < 384 ) {
- if( (line.length()) > 8 ) {
- sWeightsPool[wread] = stod(line);
- wread++;
- }
- }
- }
- myfile.close();
- if( wread > 383 ) {
- return 1;
- } else {
- cout << "Failed to read all 384 weights from disk.";
- return -3;
- }
- }else {
- cout << "Unable to open ";
- cout << GFWname;
- cout << endl;
- return -1;
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment