view 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
line wrap: on
line source

//Displays a program, alternative to "cat", uses my based file library
#include <stdio.h> 
#include <stdlib.h>
#include <string.h>
#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);
}