Answers for "open file from c"

C
19

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;
}
Posted by: Guest on April-30-2020
1

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);
}
Posted by: Guest on May-30-2021

Code answers related to "C"

Browse Popular Code Answers by Language