comparison dis.c @ 2:2b6ce8d53356

Finished program, fully functional, seems to be faster than cat
author VilyaemKenyaz
date Sat, 26 Aug 2023 14:03:02 -0400
parents b82f21466dfd
children a499c3c6b9ae
comparison
equal deleted inserted replaced
1:b82f21466dfd 2:2b6ce8d53356
3 #include <stdlib.h> 3 #include <stdlib.h>
4 #include <string.h> 4 #include <string.h>
5 #include "basedfilelib.h" 5 #include "basedfilelib.h"
6 6
7 void main(int argc, char* argv[]){ 7 void main(int argc, char* argv[]){
8 if (argc == 1 ) { puts("Dis by William King at Peep Soft\nDisplays a file to stdout, better than cat at this purpose\nUsage: dis (file)");exit(0);} 8 if (argc == 1 ) { puts("Dis by William King at Peep Soft\nDisplays a file to stdout, better than cat at this purpose\nUsage: dis (file)");exit(0);}
9 puts("Displaying:"); 9 //puts("Displaying:");
10 char * filetoread = argv[0]; 10 char * filetoread = argv[1];
11 char * file = ReadFile(filetoread); 11 char * file = ReadFile(filetoread);
12 printf("%s\n",filetoread); 12 //printf("Contents of argv: %s\n",*argv);
13 printf("%s\n",file); 13 //printf("Reading file: %s\n",filetoread);
14 while(strlen(file) != 0){ 14
15 char * print = ReadLine(file,1); 15 while(strlen(file) != 0){
16 DeleteLine(file,1); 16 //char * print = ReadLine(file,1);
17 } 17 printf("%s\n",ReadLine(file,1));
18 exit(0); 18 DeleteLine(file,1);
19 }
20 exit(0);
19 } 21 }
20 22