int main(int argc, char **argv)
errno = 0;
/Check for no. of arguments and try opening file/
if (argc == 1)
printf("There is no file selected.\n");
printf("Usage: test <filename> <filename> \n");
for (int i = 1; i < argc; i++)
if((f = fopen(argv[i], "r")) == NULL)
printf("File: %s cannot be opened. \n", argv[i]);
fprintf(stderr, "Open file %s failed: %s\n", argv[i], strerror(errno));
/read from text file as characters/
while ((c = fgetc(f)) != EOF )
if(c == '"')
while((c = fgetc(f)) != '"')
Hi there....the above is what I have got so far. It checks for the number of arguments and open the files specified. The it reads from the text files that the file is specified.
To read the contents of the file, check validity for absolute reference to a file ie. hypertext starting with file:/
eg <a href="file:/example">. Should be recursive as well
I have managed to check for < > and read any text inside the < > but I need to extract anything that is after file:/. I tried using fgets as well...but I cant seems to filter out text that is after the file:/.
Any help, suggestions and comments are welcome as I am still new with C.