Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. ifstream ifs;
  2. ifs.open("image_server.conf");
  3. if(!ifs){
  4. cerr << "failed to open config file";
  5. exit(1);
  6. }
  7. string line, info;
  8. while(ifs.eof() == false){
  9. getline(ifs,line);
  10. info = line.substr(line.find("="+1));
  11. if(line.substr(0,line.find("=")) == "LISTEN_PORT")
  12. LISTEN_PORT = atoi(info.c_str());
  13. else if(line.substr(0,line.find("=")) == "IMAGE_SAVE_DIR")
  14. IMAGE_SAVE_DIR = info;
  15. else if(line.substr(0,line.find("=")) == "LOG_FILE")
  16. LOG_FILE = info;
  17. }
  18. ifs.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement