I have a function that contains a do loop. Can I return from inside the loop? Like this:
Thanks!Code:int myfunction(char *str, ...){ ... do {... n = read(...); if (n<0){ // error reading from serial port if (errno==EBADF || errno==EIO){ return (-1); // exit from function while still inside the do loop, is this OK? } } if (n > 0) { // process read data ... } } while ( ... ); ... return ntot; // normal exit from function }