StdIn, double array Programming Software Development by rachelmorg … of a string array and another function to use StdIn to populate the array my code is public static …int i = 0; i < a.length; i++) a[i] = StdIn.readString(); if (a[a.length-1] != null) { double(a); } for…is, set up an initial array, populate it with StdIn read, but if the inputs are more than the array… Re: stdin & stream Programming Software Development by WaltP …, instead of using the [I]fopen()[/I], simply assign [I]stdin[/I] to your stream: [code] FILE *stream; if (argc <…; 2) { stream = stdin; } else { stream = fopen(argv[i],"r"); if (stream… stdin.readlin() doesn't want to work ? Programming Software Development by Rentro … a lot. Now I've gotta struggle with the "stdin.readline()" which doesn't wanna work for some odd… stdin & stream Programming Software Development by yuzhang … should do now to check if there is a redirection stdin. Many thanks Problem using select(), stdin Programming Software Development by rai32 … client, and a server. The client listens to both stdin and sockfd using select. The objective is as follows:…of the client: [code] FD_ZERO(&rset); FD_SET(fileno(stdin),&rset); FD_SET(sockfd,&rset); tv.tv_sec=timeout; …. However, if i just put "sockfd", stdin works perfectly, but of course, i can't receive … How to append sys.stdin buffer as an element to a list? Programming Software Development by ryniek …"\n" break else: num_lst.append(inpt) sys.stdin.flush() for i in num_lst: if isinstance(i, int): …but here: [CODE] else: num_lst.append(sys.__stdin__) sys.stdin.flush() for i in num_lst: if isinstance(i, int):… how to properly flush the input stream (stdin) Programming Software Development by jephthah …org/forum/linux-programming-scripting/41287-problem-fflush-stdin-function.html"]ON [/URL][URL="…://www.dreamincode.net/forums/showtopic45833.htm"]"STDIN" [/URL] here is one method of…n",sizeof(userInput)-1); fgets(userInput,sizeof(userInput),stdin); FLUSH_STDIN(userInput); // strip newline, flush extra … Re: problem with stdin Programming Software Development by G-Do …python's input commands? If you're set on using stdin, you could try this:[CODE=python]import sys inp …print inp # Do your calculations right here inp = sys.stdin.readline()[/CODE]Stolen from [URL="http://www.dalkescientific.com…make sense to run a for-loop through sys.stdin, as sys.stdin isn't a collection of anything. Hope this… Redirect stdin and stdout Programming Software Development by slatk3y ….h> #include <sys/types.h> #define STDIN fileno(stdin) #define STDOUT fileno(stdout) #define STDERR fileno(stderr) int…childpid == 0) { /* Child process */ close(PARENTWRITE); close(PARENTREAD); dup2(CHILDREAD, STDIN); dup2(CHILDWRITE, STDOUT); close(CHILDREAD); close(CHILDWRITE); execv("cat… Re: How to append sys.stdin buffer as an element to a list? Programming Software Development by ryniek …]raw_input()[/B] but i'd like to use [B]sys.stdin[/B], just don't know why this buffer isn't… Re: How to append sys.stdin buffer as an element to a list? Programming Software Development by griswolf … breaking the loop. Better if at line 11: inpt = sys.stdin.readline().strip() or line 13:if inpt.strip().lower().startswith… problem with stdin Programming Software Development by gawain_ … lines = 0 words = 0 chars = 0 for line in sys.stdin: lines = lines +1 words = words +1 chars = chars + 1 print…[/ICODE] I write some text from stdin/keyboard, but then ... how can I leave the stdin, so that the file can process… Re: problem with stdin Programming Software Development by gawain_ … over the lines of a file (strange use of sys.stdin), your code does not make much sense. It might give… corrected two lines like this using a variable instead of stdin and it works [ICODE]words = words + len(line.split()) chars…(line)[/ICODE] But still there remains the problem of the stdin Reading from piped stdin with read()? Programming Software Development by tag234 … trying to write a program that will read from either stdin from a file (using <) or from piped input. I… correctly... Ive tried using read() to read 1 character from stdin into an integer, and then setting buffer[i] to those… question is how can I read a variable size piped stdin with read() into a buffer? I must use read() in… How to read data from stdin. Programming Software Development by techie929 Hi, Could anyone please tell me how can i input data either from a file or stdin. If the file name is not specified the data can be read from the UNIX command prompt using stdin. I know stdin is a file pointer but how to use it please explain?? Re: how to properly flush the input stream (stdin) Programming Software Development by David_50 Now, if stdin is a pipe or such, a read() too big will stall, so many apps read() one byte at a time to get earlier access to input. bash:redirecting stdin to at command Programming Software Development by flying … parameters to the file. I have explored trying to use stdin redirection to bypass the interactive 1 command per line , using… to simulate the newline, CTRL-D used w/ the interactive stdin; at now +3 days << /path/script -foo -bar… Capture stdin output from popen2 Programming Software Development by maddog39 … python application I am trying to capture the output of stdin from a command that I run via popen2(). The python… docs say that it returns a tuple of (stdin, stdout) however and i run: [code=python] result = popen2(command… Re: problem with stdin Programming Software Development by Lardmeister Even if you iterate over the lines of a file (strange use of sys.stdin), your code does not make much sense. It might give you the number of lines, but surely not the number of words or characters this way. Re: problem with stdin Programming Software Development by Lardmeister I am not sure where you get that stdin notion from? Python has its own functions for input and … Re: problem with stdin Programming Software Development by gawain_ … have been quite useful. I don't mind writing from stdin; I'm just learning Python. I eventually prefer to process… Read Files From stdin Programming Software Development by petzoldt01 …. I want to read these images through my program's stdin, and this is where my troubles begin. Does <iostream… on the filesystem. How do I read a file from stdin, and to top that, not just one file, but consecutively… Possible buffering problem with sys.stdin, sys.stdout Programming Software Development by tdeck ….stdout.write("What is your name? ") x = sys.stdin.readline() sys.stdout.write("Hello, "+x) [/CODE] When… the prompt and greeting afterward. I tried this: [CODE] sys.stdin._line_buffering = False sys.stdout._line_buffering = False [/CODE] but to no… Re: Reading from piped stdin with read()? Programming Software Development by banders7 Check this post in the C code snippets: "Determining if stdin data exists for your program BEFORE issuing fgetc() or similar command." It's on page 4 of the snippets. How To dup my fifo to stdin??? Programming Software Development by grassboy … read(myFifo, str, 6); //version 2 (with dup fifo to stdin) close(0); dup(myFifo); scanf("%s", str); fprintf…", str);[/b] althought the FIFO has been dup to stdin did I have some misconception about mkfifo() function ? and how… Re: How to read data from stdin. Programming Software Development by techie929 … optional file is not specified, your program should read from stdin. You must follow the UNIX convention that commandline options can… Timeout/timer on cin/stdin/cin.get() etc.. Programming Software Development by triumphost … Password: "); static HANDLE stdinHandle; // Get the IO handles // getc(stdin); //If I take out the // from infront of getc…(stdin); user can type but it doesnt accept it.. stdinHandle = GetStdHandle(… c programming stop reading from stdin Programming Software Development by COKEDUDE When using fgets to read from stdin how do you stop reading from stdin? Re: If stdin is empty? Programming Software Development by flaerpen I found the solution by myself. use sys.stdin.isatty() to find out whether the script is executed as a part of pipeline or standalone. The method should return True if stdin is connected to a terminal, and False otherwise (pipeline or file redirection). Re: restoring stdin as keyboard Programming Software Development by Salem Make a copy of 0 using dup() before you close it, so that you can dup() it again to get back to it. IIRC [INLINECODE]keep = dup(0); close(0); dup(fd); // fd is now stdin close(0); dup(keep); // back to original stdin[/INLINECODE]