im trying to get a line using getline() function from an input file, but it is ignoring end line character. is there any other function that would including the end line character? btw, im not allowed to use something like aString+'\n'
thanks in advance~
im trying to write a program copying lines from input to output file r, and i cant specific any other buffer(ex aString+'\n'). if im using getline, then all lines would stack together. in other word, i want both file(input and output) to be identical the same...if i use aString+'\n'.. the end of the file would actually contain one more character
fgets would gives me another problem i just tried, where if i allocated the array of character to big and not knowing the length of the current line...it then copy the unused part of the array(random stuffs)into my output file. still trying to figure out how to fix this problem.
fgets() reads up to n-1 characters or \n, whichever comes first.
Write out what was read.
Read again to get the next batch of characters.
If the first fgets() reads 1/2 a line, the next fgets() reads the rest.