My program reads a text file containing various lines of text for the settings file. Some of the lines can become very large. Currently, the buffer size is 4096 characters. Perhaps some lines may exceed this, whether it be maliciousness or due to various factors operating within the program.
The current routines were quite tedious to write, and now I want to expand the possible contents of the file, which will require more of this tedious repeating code. (This is for a settings type file consisting of name value pairs and a random section header. Some numerical values ββneed to be read as strings due to multiple precision).
The main thing I want is to read an arbitrary string of length without buffer overflow. I just discovered that getline can do this for me, but is there a library in heaven that will just do all this tediousness for me?
change
I donβt want me to put the = sign between the name and values, the empty space should be sufficient as a separator.
By prevalence, I mean that the library should be available in standard packages of popular Linux distributions.
I know libconfig , but for my requirements it seems like a complete kink.
c linux file-io settings
James morris
source share