c++ Programming Glossary: errno
Differentiate between a unix directory and file in C++ http://stackoverflow.com/questions/1036625/differentiate-between-a-unix-directory-and-file-in-c a complete compilable program. #include stdio.h #include errno.h #include sys stat.h int main int argc char argv int status.. object. status stat argv 1 st_buf if status 0 printf Error errno d n errno return 1 Tell us what it is then exit. if S_ISREG.. stat argv 1 st_buf if status 0 printf Error errno d n errno return 1 Tell us what it is then exit. if S_ISREG st_buf.st_mode..
How do I get the directory that a program is running from? http://stackoverflow.com/questions/143174/how-do-i-get-the-directory-that-a-program-is-running-from if GetCurrentDir cCurrentPath sizeof cCurrentPath return errno cCurrentPath sizeof cCurrentPath 1 ' 0' not really required..
How to parse space-separated floats in C++ quickly? http://stackoverflow.com/questions/17465061/how-to-parse-space-separated-floats-in-c-quickly data. This is probably the most difficult issue. char end errno 0 double tmp strtod begin &end while errno 0 && end begin do.. issue. char end errno 0 double tmp strtod begin &end while errno 0 && end begin do whatever with tmp... begin end tmp strtod..
gcc - significance of -pthread flag when compiling http://stackoverflow.com/questions/2127797/gcc-significance-of-pthread-flag-when-compiling way some libc headers work. As a specific example it makes errno call a function returning a thread local location. share improve..
What are the rules about using an underscore in a C++ identifier? http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier of reserved identifiers with external linkage includes errno math_errhandling setjmp and va_end . Some additional classes..
Where is a file mounted? http://stackoverflow.com/questions/2337139/where-is-a-file-mounted fp return mnt endmntent fp Should never reach here. errno EINVAL return NULL Thanks to @RichardPennington for the heads..
Read whole ASCII file into C++ std::string http://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring best answer #include fstream #include string #include cerrno std string get_file_contents const char filename std ifstream.. contents 0 contents.size in.close return contents throw errno credit of the above code insane coder To Tyler McHenry if you..
How to set a timeout on blocking sockets in boost asio? http://stackoverflow.com/questions/291871/how-to-set-a-timeout-on-blocking-sockets-in-boost-asio and the timeout has been reached then 1 is returned with errno set to EAGAIN or EWOULDBLOCK just as if the socket was specified..
C++ - How to set file permissions (cross platform) http://stackoverflow.com/questions/592448/c-how-to-set-file-permissions-cross-platform result _chmod path mode MS_MODE_MASK if result 0 result errno return result #else static inline int my_chmod const char path.. mode_t mode int result chmod path mode if result 0 result errno return result #endif It's important to remember that my solution..
How can I create directory tree in C++/Linux? http://stackoverflow.com/questions/675039/how-can-i-create-directory-tree-in-c-linux 2012 TABSTOP 4 #include jlss.h #include emalloc.h #include errno.h #ifdef HAVE_UNISTD_H #include unistd.h #endif HAVE_UNISTD_H.. not exist. EEXIST for race condition if mkdir path mode 0 errno EEXIST status 1 else if S_ISDIR st.st_mode errno ENOTDIR status.. mode 0 errno EEXIST status 1 else if S_ISDIR st.st_mode errno ENOTDIR status 1 return status mkpath ensure all directories..
Compare std::wstring and std::string http://stackoverflow.com/questions/7141260/compare-stdwstring-and-stdstring cassert #include cstdlib #include cwchar #include cerrno Dummy overload std wstring get_wstring const std wstring s return.. NULL cs 0 NULL if wn size_t 1 std cout Error in mbsrtowcs errno std endl return L std vector wchar_t buf wn 1 const size_t wn_again.. wn 1 NULL if wn_again size_t 1 std cout Error in mbsrtowcs errno std endl return L assert cs NULL successful conversion return..
recursive folder scanning in c++ http://stackoverflow.com/questions/983376/recursive-folder-scanning-in-c fts may change the program's current working directory if errno perror fts_read return 1 if fts_close tree perror fts_close..
|