Mercurial Hosting > dis
annotate dis.c @ 1:b82f21466dfd
You can just printf the file what are you doing!
| author | VilyaemKenyaz | 
|---|---|
| date | Fri, 25 Aug 2023 22:59:12 -0400 | 
| parents | e92d7e15bc33 | 
| children | 2b6ce8d53356 | 
| rev | line source | 
|---|---|
| 0 | 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 | 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[]){ | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
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);} | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
9 puts("Displaying:"); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
10 char * filetoread = argv[0]; | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
11 char * file = ReadFile(filetoread); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
12 printf("%s\n",filetoread); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
13 printf("%s\n",file); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
14 while(strlen(file) != 0){ | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
15 char * print = ReadLine(file,1); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
16 DeleteLine(file,1); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
17 } | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
18 exit(0); | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
19 } | 
| 
 
b82f21466dfd
You can just printf the file what are you doing!
 
VilyaemKenyaz 
parents: 
0 
diff
changeset
 | 
20 | 
