Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char* filename = "energy.txt";
- char str[1000];
- FILE *fp;
- int main (void){
- fp = fopen(filename, "r");
- readFile();
- return 0;
- }
- void readFile(){
- if (fp == NULL){
- printf("Could not open file %s",filename);
- return 1;
- }
- while (fgets(str,1000, fp) != NULL)
- printf("%s", str);
- fclose(fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement