how to open a file in c and read it code example
Example 1: read files in c
#include<stdio.h>
int main(){
FILE *in=fopen("name_of_file.txt","r");
char c;
while((c=fgetc(in))!=EOF)
putchar(c);
fclose(in);
return 0;
}
Example 2: how to open a file with open in c
int main (void)
{
int fd = open("path_name.c", O_RDONLY); // the file is now open, you just need to read it
return (0);
}