Pseudocode:
declare counter
declare filename[8]
main
Open input
Declare buffer
do
read(512 bytes into buffer from input)
while (not start of jpeg)
do
write filename
open output file with filename (using "a")
do
write to output file
read from input file
while (not start of jpeg)
close file
add to counter
while (more than 1 block left)
close input
return 0;
This causes a segmentation fault
Valgrind - 1 error 1 context
Leak summary - 704 bytes in 2 blocks
352 by main line 21 (open input file)
352 by main line 48 (open output file)
I have an issue with opening my files but I can't figure out where for the life of me. Any clues would be greatly appreciated.
Cheers
Adam
read from output file
. Do you really meanread from input file
?