Questions tagged [input-buffer]

Anything related to input buffers and correlated techniques, i.e. memory areas used as temporary storage for information read on input. Input buffering is usually used to increase the efficiency of the input operations.

Anything related to input buffers and correlated techniques, i.e. memory areas used as temporary storage for information read on input. Input buffering is usually used to increase the efficiency of the input operations.

44 questions
2
votes
2 answers

how to parse from file after parsing from string?

My bison / flex parser start by reading input from a file: FILE *myfile = fopen(file.c_str(), "r"); yyin = myfile; yyparse(); At some point after that, it reads and parse input from a string in…
mhmhsh
  • 161
  • 1
  • 13
1
vote
0 answers

Cannot get reset_input_buffer() function to work at all in Pyserial 3.5. Does anyone have any idea what may be happening?

I am trying to simulate a communication protocol where I am following a pattern, so I constantly loop though looking for the same set of characters to reply information. I'm using an RS-232 adapter and the protocol I am simulating is asynchronous…
1
vote
1 answer

How to select which one to show in case of dual video in .mp4 file?

I'm using surfaceView where i'm rendering the video. I have a .mp4 file with video/hevc and video/avc. I made two threads such that they are extracted, decoded and rendered to the surface though the surfaceView. i can choose which video to show in…
1
vote
1 answer

While loop skips the first `fgets()` on second iteration

I know questions like this get asked all the time, and I have read several, however, I never use scanf() in my code like all the other ones, so I cannot find a comparable question. I don't know why on the second, third, fourth and so on iterations,…
Dan
  • 451
  • 3
  • 13
1
vote
0 answers

Asynchronous input in MASM assembly language

I have a project of making a stop watch in assembly language using masm. The stop watch starts on program startup and continues on. I want to implement feature like stop,pause and play. I can't ask user to input any value when the stopwatch is…
Syed Ahmed Jamil
  • 1,881
  • 3
  • 18
  • 34
1
vote
1 answer

C programming, Can anyone explain this?

#include int main() { int c; while ((c = getchar()) != EOF) { if (c == '\t') printf("\\t"); else if (c == '\b') printf("\\b"); else if (c == '\\') printf("\\\\"); …
1
vote
2 answers

How does input buffering work in C++

Here is a code snippet. I'm confused as to how the buffering internally works. while(true) { cout << "Enter a character: "; cin.ignore(3, '\n'); ch = cin.get(); // ch is char type cout << "char: ch: " << ch << endl; …
Chaitanya
  • 3,399
  • 6
  • 29
  • 47
1
vote
4 answers

getchar not working in switch case (c)

Using a very simple calculator program that prompts a user for an operation to perform, followed by a prompt for two integers on which to perform this operation. The program is supposed to loop after these operations, except in the case where the…
Stumbler
  • 2,056
  • 7
  • 35
  • 61
0
votes
3 answers

SQL Server: Query SysProcesses and InputBuffer

I am trying to pull the input buffer data (DBCC INPUTBUFFER(@SPID)) for each record returned for a database when querying the SYSPROCESSES table. I am interested to hear if there is a better way to accomplish this, but would also appreciate…
jon3laze
  • 3,188
  • 6
  • 36
  • 69
0
votes
0 answers

Reading/writing to active input stream in Rust

Is it possible to read and write to an active input stream in Rust? assuming this code: print!("[{}]>> ", line); io::stdout().flush(); line += 1; let mut input = String::new(); io::stdin().read_line(&mut input)?; I would like to read individual…
Its Me
  • 174
  • 1
  • 8
0
votes
1 answer

When reading from /dev/tty, what is happening in input and keyboard buffer?

I am playing with the following two code snippets // Snippet1 in C #include int main(){ FILE * fp = fopen("/dev/tty", "r"); int c = getc(fp); printf("%d", c); } // Snippet2 in Rust use std::io::Read; use std::fs; fn main()…
Steve Lau
  • 658
  • 7
  • 13
0
votes
2 answers

How does this clear the input buffer?

I found this code that clears the input buffer, but I don't really understand how it works. Can anybody explain it in a simple way? do{ fgets(string,LENGTH,stdin); } while (strlen(string) > 0 && string[strlen(string) - 1] != '\n');
Gio Bur
  • 15
  • 6
0
votes
0 answers

Catch Ctrl+D after having read some input

I'm trying to write a program that works like a UNIX terminal. So when Ctrl+D is pressed, it should exit. I'm reading input using: char input[BUFFER_SIZE]; read(0, input, BUFFER_SIZE) I'm also storing the output like this: int num_read = read(0,…
Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
0
votes
1 answer

input buffer while creating multiple objects using for loop in java

I want to create multiple objects using for loop in java but this code is not showing proper output, I can take all inputs properly but output is not shown by the program for the input taken for arr[i].model=sc.nextLine();. And the program is…
0
votes
2 answers

Problems with cin.getline() not accepting input

I am using cin.getline() to store user input in a character array, and attempting to parse input to only allow numbers ranging from 1 to 4 to be entered. Things work fine under a specific set of circumstances: correct input is entered on the first…
user7454726