Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. char *comand = new char[query.length()]; // Create pointer to store the query
  2. strcpy(comand, query.c_str()); // Convert the query to char [] which is the necessary format for the write command.
  3. int n_written = 0;
  4. int spot = 0;
  5.  
  6. do {
  7. n_written = write( USB, &comand[spot], 1 );
  8. spot += n_written;
  9. } while (comand[spot-1] != 'n' && n_written > 0);
  10.  
  11. delete[] comand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement