How to use fclose() function to close a file in C

1 Answer

0 votes
#include <stdio.h>
  
int main(void)
{
	char s[32];
	
	FILE *fp  = fopen("d:\\data.txt", "r");
	
	fscanf(fp, "%s", s);
	printf("%s", s);
		
	fclose(fp);
    
	return 0;
}
 
 
/*
run:
 
code

*/

 



answered May 2, 2016 by avibootz

Related questions

...