Intensive String functions
Not as expected, this post is not help request
I am developing an assembler. And while I am developing this program, I found myself creating generic string functions which I ound very useful. I want to share these functions .. where should I post them?
functions I developed till now:
// which adds a string in an array of strings
char ** addToString(char ** stringArray, char * string, unsigned int numberOfLines)
// which returns a line from a file
char * readLine(FILE * stream)
// which returns the line requested by its number. Note: this function needs the function above.
char * readLine(FILE * stream, unsigned int lineNum)
// returns a string entered by the user. It's like Console.ReadLine() in C# or raw_input() in Python.
// appends a string to another string.
char * append(char * mainString, char * appendedString)
all functions above automatically handles the memory. That is, all you have to worry about is the name of the variable you create and nothing more
// input will hold the input string from the user
char * input = getstring();
// line will hold a line read from the file. if EOF reached, "EOF" is returned.
char * line = readLine(filePointer);
// newString will hold the string "the new"
char * newString = append("the", " new");