All Questions
Tagged with user-input c
364 questions
2
votes
1
answer
83
views
Storing user input into an array and terminating at stopping value without storing that value in C
I know how to write a while loop that reads user input, stores into an array then terminates at the stopping value. However, that stopping value is also stored and I'm not sure how to have it not do ...
0
votes
1
answer
75
views
C - write() repeats after reading user input with spaces
I'm creating a shell program with C and am working on getting user input after displaying the current working directory. I'm using read() and write() as I will need to use signals within my shell ...
2
votes
1
answer
115
views
Parsing with a space (sscanf or strtok)
For some context, my game runs in the terminal and is like a command line type game. At the moment to process commands is does a strcmp() for every single command which isn't really pretty nor ...
0
votes
1
answer
58
views
Unable to take user Inputs in C language in Sublime Text
I want to take user inputs in c language but I am unable to as the Sublime Text does not allow that. I want to create a build system for C that will take user inputs and display output in the default ...
0
votes
0
answers
109
views
How do I make my C code return the error message for alphanumeric input [duplicate]
My code is supposed to take in a numeric score and return the grade it will receive. My code correctly returns an error message for all invalid input except alphanumeric. With alphanumeric input, it ...
1
vote
1
answer
56
views
Error while using scanf for user inout in C [duplicate]
I am trying to make a script which will need an integer as user input.
printf("What is your guess?\n--> ");
int guess;
scanf("%d", &guess);
But when I try to ...
0
votes
1
answer
57
views
User input comparing in C, unexpected symbols in user input array
Im trying to compare user input string with the example inside function, using gets() and strcmp to do this.
I've tried this code:
#include <stdio.h>
#include <string.h>
int main() {
/...
-2
votes
1
answer
57
views
Queues in C programming [closed]
This is the statement of the question (C programming):
A crowdsourcing system is a web platform through which various types of micro-tasks are made available, such as labeling images, annotating text ...
0
votes
0
answers
62
views
Ignoring any characters and numbers after empty line in C
I've been coding in C and I have a slight problem. The problem is that i need to ignore all the chars and numbers when the input is just an empty line. I can keep on adding inputs, but after empty ...
2
votes
1
answer
41
views
Double N to break out asking user if they want to run again and promt again for new input
I am trying to ask a user if they would like to try again a new computation, I used old code from another lab I had but can't seem to get it to adjust proper for this new one.
My problem is that when ...
1
vote
2
answers
320
views
Is 'printf("%s", user_input)' dangerous?
I know that printf(user_input) is dangerous, but what about printf("%s", user_input)? Is this generally safe as long user_input is NUL terminated?
1
vote
0
answers
50
views
Problems with scanf and UI
I'm wanting to receive UI and process that information. Particularly i'm receiving (in this order) 2 (unsigned) ints, 1 char, and an array of strings. The problem is that it doesn't read the string ...
0
votes
0
answers
54
views
Why do I get a Segmenation Fault in my code? (C)
I am trying to request three strings from the user, and while the first two work and go through correctly, the third one gives a Segmentation Fault while running. The first two are pretty much ...
1
vote
2
answers
217
views
C Programming Input Validation for checking if entire string is alphabet [closed]
I have working code when i just test char[] = "Gabriella". However, I need to get user input. Getting the input from the user breaks my code and I do not understand why.
#include <stdio.h&...
0
votes
1
answer
55
views
How do you accept input without using scanf (using input from compile command in terminal)?
I'm a beginner to C and I'm trying to accept input from zsh terminal using
./filename 1234 5678
So, instead of using scanf where you compile and run then get prompt to input numbers, I want to write ...