I've been trying PSet4's Recover. I've been trying to obtain the size of the entered file (card.raw
) but unfortunately size
gives and output of 0
.
Here's the code that I've made to find the file's size:
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int counter = 0;
if(argc != 2)
{
printf("Usage: ./recover image\n");
return 1;
}
FILE *recover = fopen(argv[1], "r");
if(recover == NULL)
{
printf("ERRNO 1 IS %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
fseek(recover, 0L, SEEK_END);
unsigned long size = ftell(recover);
fseek(recover, 0L, SEEK_SET);
printf("Size is : %lu", size);
}
One thing that seems to be happening is that changing argv[1]
to argv[0]
actually gives me a non zero file size. Any reason why this happens?
card.raw
says0 bytes
when I hover the cursor over the file. Does that mean that the file is not there?.zip
file and extracted the files within twice. I'll try again.