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
0
votes
0 answers

Thread 6: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

I am reading bytes from Data. But am getting a crash after first iteration of while loop. Note: This is not index out of bounds issue. func readData(data: Data) { if isPacketRecieved == true { …
iAnurag
  • 9,286
  • 3
  • 31
  • 48
0
votes
0 answers

C++ with menu system: How to eliminate input buffers when pressing arrow keys

I was able to make a program that has a menu on it. At first, the program is running smoothly. The problem starts to appear when, at a certain point in the program, the user starts inputting something and then navigating the menus again. Sometimes…
Ryon
  • 23
  • 4
0
votes
0 answers

Can't clear cin. Stuck at input

When cin fails, it fails for ever. I.e. I can't read anything afterwards and cin.fail() always returns true, no matter how I try to clear it. Minimal code to recreate: #include using namespace std; int main(){ int d; while…
iBug
  • 35,554
  • 7
  • 89
  • 134
0
votes
0 answers

regarding clearing the input buffer in c

I have this code, a program to take an integer from a user that's negative, if not trap them in a loop until they enter a negative integer. I have this part down, however, how could i clear the input buffer? I tried to use while ((getchar()) !=…
0
votes
2 answers

How to know the input buffer of the serial port has information, in C#?

I am building a program in C# to be used in one of my course at a college to demonstrate how Asynchronous connections work using RS-232 and two computers connected together. My course is not about programming, but data networks, so the connectivity…
DonPandon
  • 1
  • 2
0
votes
2 answers

AudioTrack not working, there is no sound

can you check why is my Audiotrack not working, i do have a buffer in and out to the audiotrack, it should be able to work. public class MainActivity extends AppCompatActivity { private MediaExtractor extractor; private MediaCodec decoder; private…
0
votes
0 answers

No input buffering and flush stdin sometimes clears one input character (c++, windows)

Issue is related only to Windows. I am using visual studio 2012 compiler (vc11). I would like to read few lines (character by character) from input file (which is redirected as stdin). But after reading each line, I would like to fflush stdin. Let…
piotrp
  • 324
  • 2
  • 6
0
votes
0 answers

Present message and prompt re-enter into array if too many characters "out of bounds" entered into an array

I just can't figure it out. I'm not allowed to use the string library, first of all. But, I want the user to enter their major into a char array, but if they enter too many (runs into input buffer), then present a message and prompt to re-enter…
Quadruckus
  • 21
  • 4
0
votes
2 answers

Pre-populating input in Java console

I'm making a console-based Java/Groovy application that does a lot of find/replaces in text files. If, say, the program knows you replaced foo with bar last time, it should by default know you probably want to replace the next foo with bar as well.…
Drew Reagan
  • 785
  • 6
  • 10
0
votes
1 answer

C++ cin keeps skipping

I am having problems with my program. WHen I run it, it asks the user for the album, the title, but then it just exits the loop without asking for the price and the sale tax. Any ideas what's going on? This is a sample run Discounts effective for…
user69514
  • 26,935
  • 59
  • 154
  • 188
0
votes
1 answer

Line feed ending getchar() loop prematurely

I have a problem that I cannot find an actual solution after searching for about half a day. In this program, I have to fill an array of structs with customer information. I also have to do a couple other things, but I cannot figure out this bug in…
-1
votes
2 answers

what do modifiers like whitespace do in scanf?

#include void main() { char a,b; printf("enter a,b\n"); scanf("%c %c",&a,&b); printf("a is %c,b is %c,a,b"); } 1.what does the whitespace in between the two format specifiers tell the computer to do? 2.do format specifiers like %d other…
user7052050
-2
votes
3 answers

How to clear input buffer when scanning values from a text file in C?

#include #define MAX_TITLE_SIZE 20 #define MAX_BOOKS 10 struct Book { int _isbn; float _price; int _year; char _title[MAX_TITLE_SIZE + 1]; int _qty; }; void clear(void); int readRecord(FILE *fp, struct Book…
mincedMinx
  • 159
  • 1
  • 3
  • 12
-4
votes
3 answers

is clearing the buffer by assigning char * buffer to '\n' while getting user input inside a loop in c wrong?

I tried to solve the problem* I face when I want to get user input inside a loop. edit *: problem is this -> clearing buffer to read next input. is this error-prone? #include int main(){ char buffer[10]; while(1){ …
zuxi
  • 3
  • 3
1 2
3