diff 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
line wrap: on
line diff
--- a/dis.c	Fri Aug 25 22:59:12 2023 -0400
+++ b/dis.c	Sat Aug 26 14:03:02 2023 -0400
@@ -5,16 +5,18 @@
 #include "basedfilelib.h"
 
 void main(int argc, char* argv[]){
-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);}
-puts("Displaying:");
-char * filetoread = argv[0];
-char * file = ReadFile(filetoread);
-printf("%s\n",filetoread);
-printf("%s\n",file);
-while(strlen(file) != 0){
-char * print = ReadLine(file,1);
-DeleteLine(file,1);
-}
-exit(0);
+	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);}
+	//puts("Displaying:");
+	char * filetoread = argv[1];
+	char * file = ReadFile(filetoread);
+	//printf("Contents of argv: %s\n",*argv);
+	//printf("Reading file: %s\n",filetoread);
+
+	while(strlen(file) != 0){
+		//char * print = ReadLine(file,1);
+		printf("%s\n",ReadLine(file,1));
+		DeleteLine(file,1);
+	}
+	exit(0);
 }