frankfurt_schoolgirl [she/her]@hexbear.nettoProgramming@programming.dev•How do I handle an input thats more than the char size in c?English
1·
1 year agoDidn’t know about that one, thanks!
Didn’t know about that one, thanks!
If you want to accept a user input of any length, you have to read the input piece by piece and allocate a new buffer if the original becomes full. Basic steps would be:
malloc
to make a char *
buffer\0
to your buffer and break the loop. You’re done!memcpy
to copy the stuff from the old buffer to the new one. Use free
to get rid of the old buffer.This will work until you fill the entire memory of your computer. You should probably set a max length and print an error if it is reached.
Maybe you could just try a different Transmission docker image or build your own? Sounds like some weird instability in that particular version.