Hi I am currently trying my hand at C programming and am a bit stuck. I am trying to read in a .txt file line by line and process each line separately using fgets() but I need to ignore the newline in the file as it is affecting the output of my code. Any help would be great. Thanks in advance :)
static void Test ()
{
int bufferLength;
char* buffer = malloc(bufferLength);
FILE *file = fopen("testing.txt", "r");
while(fgets(buffer, bufferLength, file)) {
FILE *file2 = fopen("tester.txt", "w");
fprintf(file2, "%s", buffer);
fclose(file2);
FILE *file3 = fopen("tester.txt", "r");
process(file3);
fclose(file3);
}
fclose(file);
}