SHARE
TWEET

Untitled

a guest May 31st, 2014 188 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void libgt2d::Start_Lib(const char* path)
  2. {
  3.     path_str = path;
  4.  
  5.     uv_fs_t test_req;
  6.     uv_fs_t *o_req = (uv_fs_t*) malloc(sizeof(uv_fs_t));
  7.     memset(o_req, 0x0, sizeof(uv_fs_t));
  8.     o_req->data = (void*)this;
  9.     //o_req->ptr = ;
  10.  
  11.     int error = uv_fs_open(uv_loop, o_req, path_str.c_str(), O_RDWR, 0644, On_Start);
  12.     if (error)
  13.     {
  14.         std::cout << "Error opening file: " << uv_strerror(uv_last_error(uv_loop)) << std::endl;
  15.     }
  16. }
  17.  
  18. void libgt2d::On_Start(uv_fs_t *file)
  19. {
  20.     std::cout << "On start" << std::endl;
  21.     libgt2d *lib = static_cast<libgt2d*>(file->data);
  22.     uv_fs_req_cleanup(file);
  23.     free(file);
  24.     if (file->result < 0)
  25.     {
  26.         std::cout << "Error at opening file on start: " << uv_strerror(uv_last_error(lib->uv_loop)) << std::endl;
  27.     }
  28.     else
  29.     {
  30.         lib->gt2d_fd = file->result;
  31.         std::cout << "FD: " << lib->gt2d_fd << std::endl;
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top