I have have memory allocated for a file to be able to read from a input file.
((mem = (unsigned char *) malloc (filesize)) == NULL)
I have it reading from the memory (file technically). This loop will read the contents of memory and write each character into another output file only until a preset limit then it will continue to write to the next line (default 40 for each line). I have it correctly reading and writing, as well as wraping at 40 for each line BUT, the input file has multiple lines of different lengths, and the writing to the new file is including the "\n" (new lines) thus making multiple lines lengths but no greater than 40. I need to check when there is a "\n" and skip over it.
This is my problem, I'm not sure how to check if I've hit a "\n".
Here is my sad attempt (a part of the loop):
fread(mem, 1,filesize, inf);
for(i=0; i < filesize; i++)
{
*temp = mem[i];
if (!strcmp(temp,"\n"));
{
i++;
}