Timeline for pset4: what does check50 "TODO" error mean?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 11, 2015 at 21:52 | comment | added | Irene | There is no such thing as "end of jpeg". At least not as far as we can care about. When a new jpeg starts, by logic, it means that the previous one has ended. I did misread the bytes you were comparing to and that's why i misunderstood. But there's no reason to check for the end of a jpeg. Look into what fread returns, and think of how you can use that to check whether or not the end of file has been reached | |
Sep 11, 2015 at 13:39 | comment | added | user9530 | As for the (feof(file) == 0), does anyone have a better idea? I was trying to avoid hardcoding in the expected number of images, which is the only other way I know of to stop the loop. | |
Sep 11, 2015 at 13:38 | comment | added | user9530 | As for the for loop you mention doesn't do anything useful, it is looking for the end of each jpg. I realize that since the jpg are stored on the card back to back, I could just look for this in the last jpg, but I was not sure how to do this without hardcoding in the number of images to expect. If I let the program just add the entire end of card.raw to the last image then the final image although it opens is 1.2 GB which seems ridiculous. | |
Sep 11, 2015 at 13:34 | comment | added | user9530 | (1) open card.raw and until I reach the end of card.raw do the following: (2) read in 512 bytes from card.raw (3) look for start of jpg file (3a) if found open and name new file and write the 512 bytes to it (3b) if start of jpg is not found and there is file still open, write to it (4) if there is file open check the current 512 bytes for jpg end of file sequence (4a) if end of jpg sequence is found close file and set it to NULL (hence 3b will writes only when it should). After this, I close card.raw. | |
Sep 11, 2015 at 13:24 | comment | added | user9530 | I apologize if my code is confusing...I am not a programmer, but am trying to learn. This is what I believe my code is doing: | |
Sep 11, 2015 at 2:18 | history | answered | Irene | CC BY-SA 3.0 |