annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e92d7e15bc33 First commit, made by makeprogram
VilyaemKenyaz
parents:
diff changeset
1 //Displays a program, alternative to "cat", uses my based file library
1
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
2 #include <stdio.h>
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
3 #include <stdlib.h>
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
4 #include <string.h>
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
5 #include "basedfilelib.h"
0
e92d7e15bc33 First commit, made by makeprogram
VilyaemKenyaz
parents:
diff changeset
6
1
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
7 void main(int argc, char* argv[]){
2
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
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);}
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
9 //puts("Displaying:");
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
10 char * filetoread = argv[1];
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
11 char * file = ReadFile(filetoread);
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
12 //printf("Contents of argv: %s\n",*argv);
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
13 //printf("Reading file: %s\n",filetoread);
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
14
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
15 while(strlen(file) != 0){
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
16 //char * print = ReadLine(file,1);
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
17 printf("%s\n",ReadLine(file,1));
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
18 DeleteLine(file,1);
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
19 }
2b6ce8d53356 Finished program, fully functional, seems to be faster than cat
VilyaemKenyaz
parents: 1
diff changeset
20 exit(0);
1
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
21 }
b82f21466dfd You can just printf the file what are you doing!
VilyaemKenyaz
parents: 0
diff changeset
22