c++ Programming Glossary: fileno
Correct Code - Non-blocking pipe with popen http://stackoverflow.com/questions/10962044/correct-code-non-blocking-pipe-with-popen buff 512 if pipe popen command.c_str r return false int d fileno pipe while true ssize_t r read d buff sizeof buff if r 1 errno..
Capturing syscall stdout without writing to file in C/C++ http://stackoverflow.com/questions/1103047/capturing-syscall-stdout-without-writing-to-file-in-c-c fd constructor FILE p popen echo hello r std ifstream p2 fileno p std string s p2 s p2.close pclose p Using Boost.Iostreams.. to iostream boost iostreams file_descriptor_source p2 fileno p Unfortunately Windows is horrible and _popen only works for..
Detect if stdin is a terminal or pipe in C/C++/Qt? http://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe-in-c-c-qt Use isatty #include stdio.h #include io.h ... if isatty fileno stdin printf stdin is a terminal n else printf stdin is a file..
Do programmers of other languages, besides C++, use, know or understand RAII? http://stackoverflow.com/questions/165723/do-programmers-of-other-languages-besides-c-use-know-or-understand-raii open file return stream FILE fdup const int dupfd dup fileno file_ if dupfd 1 throw std runtime_error Cannot dup file descriptor..
freopen: reverting back to original stream http://stackoverflow.com/questions/1673764/freopen-reverting-back-to-original-stream share improve this question This can be achieved using fileno dup and dup2 calls. I have tried this on linux not sure whether.. pos printf stdout fflush stdout fgetpos stdout pos fd dup fileno stdout freopen stdout.out w stdout f fflush stdout dup2 fd fileno.. stdout freopen stdout.out w stdout f fflush stdout dup2 fd fileno stdout close fd clearerr stdout fsetpos stdout pos for C9X printf..
FILE * and istream: connect the two? http://stackoverflow.com/questions/1683051/file-and-istream-connect-the-two want a quick solution you can get the file descriptor with fileno and then use Josuttis' fdstream . There may be similar efforts..
How to deactivate input statement after some time? http://stackoverflow.com/questions/18289635/how-to-deactivate-input-statement-after-some-time You could use alarm to schedule a SIGALRM then use read fileno stdin ... . When the signal arrives read shall return with 1.. to occur in two seconds. char buffer 16 0 int result read fileno stdin buffer sizeof buffer 1 if 1 result if EINTR errno perror..
Coroutine demo source http://stackoverflow.com/questions/3330838/coroutine-demo-source addout byte g_len sizeof f_len 1 r 1 else f_len filelength fileno f addinp byte f_len sizeof f_len addout 0 0 r 2 do if r 1 uint.. outbuf g flush if DECODE 0 fputc 10 g else fflush g chsize fileno g g_len M int main int argc char argv if argc 4 return 1 int..
Is there a replacement for unistd.h for Windows (Visual C)? http://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c #define ftruncate _chsize #define unlink _unlink #define fileno _fileno #define getcwd _getcwd #define chdir _chdir #define.. ftruncate _chsize #define unlink _unlink #define fileno _fileno #define getcwd _getcwd #define chdir _chdir #define isatty _isatty..
|