All Questions
91
questions
0
votes
0
answers
35
views
Read a single char value to stdin without pressing enter on keybard in C in mac os [duplicate]
I am using mac os with xcode-select version 2406
I am trying to find a way to Read a char value to STDIN without pressing enter or return key on keyboard in C.
I know on windows we have getch function ...
1
vote
0
answers
42
views
How to Clear stdin while reading stream of data?
I have to create a c program that takes raw h264 frames from stdin and send it over the network via rtp.
The problem i am facing is that the video data from stdin gets read after the connection is ...
0
votes
2
answers
361
views
Standard streams vs. non-standard streams
The so-called "standard streams" in Linux are stdin, stdout, and stderr. But they must be called "standard" for a reason. Are there non-standard streams? And are these non-standard ...
0
votes
1
answer
69
views
How does a program like less handle both piped stdin and keyboard input?
If I run, for example, ifconfig | less, the less program manages to at the same time:
Capture output of ifconfig through the standard input where the output of ifconfig is piped
React to user's ...
-5
votes
1
answer
56
views
Problems with understanding code in C(STDIN_FILENO)
me and my friend have problems understanding code. We don't understand why at the end it is checked if the nread is != 1. Can someone help us we would be very glad.
while ((nread = read(STDIN_FILENO, &...
1
vote
2
answers
586
views
Does the read () system call clear the stdin buffer when it is called after getchar()?
The following output seems to suggest that when read () is called after a getchar() it clears all the stdin. Let's say that I typed "Hello\n" :
char buff;
int c;
c=getchar();
printf("%c\...
0
votes
1
answer
2k
views
Pressing Ctrl-D doesn't send EOF to my python program
I made some code in python to read stdin. When I execute it and input all the data I want I press Ctrl-D, which should send EOF macro but in reality nothing happens. Im on arch-linux using alacritty ...
0
votes
0
answers
80
views
Initialization of standart streams <stdio.h>
My teacher asked me "When stdin, stderr, stdout initialized in stdio and by whom".
I was searching for answer and found that it initialized after exec() but before main()
I don't understand ...
0
votes
1
answer
293
views
How to pipe text into stdin
I want to do something like
cat "username\npassword" | git push so that git gets the username and password since it expects the first line of stdin as username and second line of stdin as ...
1
vote
1
answer
331
views
Why are std[in,out] not line buffered even when connected to terminal?
According to unix advanced programming:
We can see that the default for this system is to have standard input and standard
output line buffered when they’re connected to a terminal.
From this example:...
1
vote
0
answers
47
views
How to send text from stdin to a script [duplicate]
Other than doing:
$ ./script < myfile.txt
Is there a way to pass text directly in the command-line, for example something like:
./script < "hello this is not a test"
The program I ...
1
vote
1
answer
4k
views
Unix cat command, pipe and stdin/stdout [duplicate]
Here is something I don't understand.
Why this works : echo "akka" | cat
But this does not produce "akka" on the console : echo "akka" > cat
And this does not even ...
1
vote
1
answer
31
views
Python: How to ensure a program ONLY takes file data from sys.stdin?
I would like to use data from a file called simdata.txt to run a simulation that I wrote in Python. I would like to ensure that when the user executes my program from the command line that the data is ...
5
votes
1
answer
1k
views
Why should I press ENTER before CTRL+D to indicate an EOF to stdin?
The following is my code, where I use fgetc to get input from stdin. (running the program from a UNIX shell)
What I don't understand is that, when I type some characters from the keyboard, and then I ...