- Joined
- Feb 4, 2010
- Messages
- 1
- Reaction score
- 0
I dont know whats wrong with my code so ig anyone could please help me i keep getting segmetation fault
#include<stdio.h>
int main(){
char s[100];
FILE*f=fopen("rec1.txt","r");
if(f==NULL)printf("greska");
FILE*g=fopen("reci2.txt","w");
if(g==NULL)printf("greska");
while(fscanf(f,"%s",s)!=EOF){
fprintf(g,"%s",s);}
fclose(f);
fclose(g);
}
#include<stdio.h>
int main(){
char s[100];
FILE*f=fopen("rec1.txt","r");
if(f==NULL)printf("greska");
FILE*g=fopen("reci2.txt","w");
if(g==NULL)printf("greska");
while(fscanf(f,"%s",s)!=EOF){
fprintf(g,"%s",s);}
fclose(f);
fclose(g);
}