I don't know if this is the best way to answer your question, but look:
std::string _getline_ ( const char *str, const unsigned int ui_size ) { std::string tmp; unsigned short int flag = 0; while ( flag < 2 ) { if( *str != '\0' ) { tmp.push_back( *str ); flag = 0; } else { tmp.push_back( ' ' ); flag++; } str++; } return tmp; }
The problem is that the "flag" will save two "\ 0" more ... I do not know what you have. But I hope that it will be useful for you ... Maybe someone wants to fix it ...
source share