diff options
author | Oskar <[email protected]> | 2024-04-03 22:22:19 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-04-03 22:22:19 +0200 |
commit | efceadecd1bc48e2169bdf693058b2be25249827 (patch) | |
tree | d2b8e34c553c3effc0f84664493dbe04c1bd71a5 /process_multiples.c | |
parent | 44c83f6d38d166a04d71dca697a7ba4d2ea40cdd (diff) |
new check_length_fix_stdin. It checks length of buffers and seems to
also fix the situation where if i input more characters in to fgets than
allowed the characters sort of get stuck in stdin and thats a problem.
Seems like this function fixes this.
Diffstat (limited to 'process_multiples.c')
-rw-r--r-- | process_multiples.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/process_multiples.c b/process_multiples.c index 0acd82d..5abbdfa 100644 --- a/process_multiples.c +++ b/process_multiples.c @@ -33,9 +33,10 @@ uint64_t call_L_plus_minus_continue(char *multiple) { uint64_t call_L_only(uint64_t focus, uint64_t Flines) { - char buf[32] = { '\0' }; + char buf[33] = { '\0' }; fprintf(stdout, "(L): "); - fgets(buf, 30, stdin); + fgets(buf, 32, stdin); + if(check_length_fix_stdin(buf) == _FAIL) { return _FAIL; } if (buf[0] == '\n') { return focus; |