Answers for "how to open a file to read line in c"

C
13

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
0

c read a whole string from a file

#define  _GNU_SOURCE  //Necessary for getline to work with clang in Ubuntu
getline(&line, &len, fp);
Posted by: Guest on November-01-2020

Code answers related to "how to open a file to read line in c"

Code answers related to "C"

Browse Popular Code Answers by Language