I would like to set my input stream as unbuffered using setvbuf()
but I don't really know how to use it.
I've done some googling and found that when you set a stream to unbuffered, the buffer and size parameters are ignored, as said by this article.
Here is my code:
#include "structures.h"
#include "functions.h"
char choice;
int option;
int main(void) {
while(1) {
puts("============================================Select an Option============================================");
puts("1. Create Linked List");
puts("2. Display items");
puts("3. Add item to the beginning");
puts("4. Add item to the end");
puts("5. Add item in the middle");
puts("6. Delete item from the beginning");
puts("7. Delete item from the end");
puts("8. Delete item from the middle");
puts("9. Exit");
printf(">>> ");
setvbuf(stdin, _IONBF);
choice = getchar();
cleanStdin();
option = choice - '0';
//...
}
}
The article says they're ignored but I still get an error about not enough parameters, so I don't know what to put in there. Can someone help me please?