summaryrefslogtreecommitdiff
path: root/wk4/pset
diff options
context:
space:
mode:
Diffstat (limited to 'wk4/pset')
-rw-r--r--wk4/pset/recover/recover.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/wk4/pset/recover/recover.c b/wk4/pset/recover/recover.c
index b1fda94..82b65a7 100644
--- a/wk4/pset/recover/recover.c
+++ b/wk4/pset/recover/recover.c
@@ -12,12 +12,9 @@ int main(int argc, char *argv[])
return 1;
}
- // Remember filenames
- char *infile = argv[optind];
-
// Open input file
- FILE *inptr = fopen(infile, "r");
- if (inptr == NULL)
+ FILE *card = fopen(argv[1], "r");
+ if (card == NULL)
{
printf("Could not open %s.\n", infile);
return 1;
@@ -55,7 +52,7 @@ int main(int argc, char *argv[])
// make buffer space to store the data
uint32_t data[photolength][16];
// read the photo to data in blocks of 32 bits
- fread(&data, sizeof(uint32_t), 16 * photolength, inptr);
+ fread(&data, sizeof(uint32_t), 16 * photolength, card);
// write the photo from data
fwrite(&data, sizeof(uint32_t), 16 * photolength, point);
// Close the photo file
@@ -69,5 +66,5 @@ int main(int argc, char *argv[])
*/
- fclose(inptr);
+ fclose(card);
}