Skip to main content

All Questions

Tagged with
0 votes
0 answers
44 views

getline() in C is not receiving input

I am trying to build a simple shell and im having a huge problem with receiving input from the stdin. For whatever reason when i call getline(), the program gets stuck there and it can't progress. ...
Percy's user avatar
  • 1
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 ...
Pritam's user avatar
  • 7
3 votes
1 answer
202 views

Reading and Writing more than 4096 bytes to and from STDIN [closed]

I'm trying to implement a here document like the one used in bash (in C), but I noticed that I can't give it a line that's longer than 4096 bytes, I looked it up and It was because of the max size of ...
Anass Abidar's user avatar
0 votes
1 answer
49 views

Redirecting stdout with execvp

This code basically a small part of the binary tree with nodes being processes, and it should traverse the tree inorder way passing num1 to left subtree etc. This one just creates a left child and ...
Özgür Çavuşoğlu's user avatar
0 votes
2 answers
156 views

Why is STDIN open by default for programs running in SystemD?

I have an if-statement at the top of a C main method, which checks if STDIN is open. If it is open, the program prints an error and exits. This is mainly for documentation reasons. I don't want ...
Seán Healy's user avatar
0 votes
0 answers
68 views

stdin file descriptor never ready on POLLIN event

I have a C source code that I intend to port from Linux to Windows. After updating the 'poll' function to 'WSAPoll,' I notice that 'revents' on 'stdin' never becomes ready, causing 'WSAPoll' to block ...
Yuki San's user avatar
1 vote
2 answers
573 views

Difference to get string with gets and fgets in C

My question is, what is the difference between these two pieces of code. 1) #include <stdio.h> #include <stdlib.h> #define SIZE 7 int main() { int strSize; char tim[SIZE]; ...
PLC_Guy's user avatar
  • 11
0 votes
1 answer
74 views

How to write a BASH command in C which use stdin and stdout

I want to write a programme where I compile a C programme, and save it where BASH recognises programmes are (/usr/bin or somewhere). For usage I want to run in the terminal $ c_programme <...
1toneboy's user avatar
  • 119
0 votes
0 answers
37 views

How to launch a program and have a pipe to both stdin and stdout in C on linux [duplicate]

I'm trying to write a C program to configure lemonbar, a status-bar for linux, and i'd like to have the bar be interactive. The problem is that to write to the bar you have to use the program stdin ...
Eto on a mill's user avatar
0 votes
2 answers
59 views

Who should be responsible for "program startup with three std streams opened"?

I'm working on my study purpose OS kernel, now I have a confusion about creating time of standard streams. The famous "APUE" said that "By convention, UNIX System shells associate file ...
08822407d's user avatar
  • 108
-1 votes
2 answers
103 views

C fgets string length not limited to input

I'm confused how even though the char array mystring I provided can only be upto 5 characters long, the length can exceed 5 if fgets is supplied with a larger limit. #include <stdio.h> #include &...
Helix Development's user avatar
1 vote
2 answers
273 views

Cannot turn off line buffering in C

So, I'm working on a big project, and it requires the stdin and stdout buffers to be disabled so that input and output are processed immediately. However, when I try to do that using setbuf or setvbuf,...
Milk_Cool's user avatar
1 vote
1 answer
182 views

How to check if input is empty?

How to check if user inputs nothing and presses enter only? If that happens then error message and code stops. In C language. I tried == '\n' and " " but nothing works :( int main() { ...
ZN00PS's user avatar
  • 11
0 votes
1 answer
72 views

How to quickly skip a certain piece of input in C

For the project I'm building for one of my courses (first time doing this, please don't bash me if I'm missing some basic things), which is basically about handling a data structure, my code should be ...
Andrea Colombo's user avatar
0 votes
1 answer
154 views

How the python interpreter receives and outputs data?

What happens when I write print('Something')? Does the interpreter work directly with the system I / O means, or does it use some kind of system API, which gives information that something needs to be ...
handler404's user avatar

15 30 50 per page
1
2 3 4 5
68