Segmentation fault
hai everybody,
I worte a program and it does prints the output and after that it showed me segmentation fault error. could anybody help me out. program is as follows: #include <stdio.h> int main() { int i,j; FILE *f; char *s1,*s2; f=fopen("junk","w"); scanf("%s",s1); if (!f) return 1; fwrite(&s1,sizeof(s1),1,f); fclose(f); f=fopen("junk","r"); if (!f) return 1; fread(&s2,sizeof(s1),1,f); printf("%s\n",s2); fclose(f); printf("\n"); return 0; } |
Quote:
You can either make it like char s1[50]; or keep your declaration the same and malloc() some memory. |
can u help me in this
Thank you , I will try that out.
can u help me in this. Now I am trying to create own login screen and authentication. Actually my login screen should come first and after that only the gdm login screen should appear. I have created my login screen using gtk+. I have redhat linux 9(shrike) and kernel version is 2.4.20-6smp. My default runlevel is 5. I am trying this for past one week but i am not getting the my login screen first when linux boots up. Please help me in this. |
thankyou
can u help me in this ( post #)
Thank you , I will try that out. can u help me in this. Now I am trying to create own login screen and authentication. Actually my login screen should come first and after that only the gdm login screen should appear. I have created my login screen using gtk+. I have redhat linux 9(shrike) and kernel version is 2.4.20-6smp. My default runlevel is 5. I am trying this for past one week but i am not getting the my login screen first when linux boots up. Please help me in this. |
All times are GMT -5. The time now is 12:28 PM. |