is there any standard c function for trimming the end of strings?
i use fgets() to read a line from a stream and since i dont know how long the stream is i malloc enough space for a 200 character line (worse-case scenario by far)
afterwards, id like to trim all the blank spaces after the end of the string so as not to waste memory.
i know it hardly makes a practical impact but id like to be as efficient as possible.
also
is there any standard algorithm for doing regular expression searches on text files? i have to implement this in C and it will be very difficult without one...
thanks!
i use fgets() to read a line from a stream and since i dont know how long the stream is i malloc enough space for a 200 character line (worse-case scenario by far)
afterwards, id like to trim all the blank spaces after the end of the string so as not to waste memory.
i know it hardly makes a practical impact but id like to be as efficient as possible.
also
is there any standard algorithm for doing regular expression searches on text files? i have to implement this in C and it will be very difficult without one...
thanks!