![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Segmentation Fault | monika | UNIX for Dummies Questions & Answers | 5 | 05-30-2008 05:30 AM |
| Segmentation fault | big123456 | Linux | 0 | 07-20-2007 06:01 AM |
| Segmentation fault | rshaikh | AIX | 2 | 04-16-2007 09:12 AM |
| Segmentation fault | jshaulis | AIX | 1 | 06-01-2004 05:16 PM |
| segmentation fault | omran | High Level Programming | 2 | 08-01-2003 09:19 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hello Friends,
Here is my programme. Code:
#include <stdio.h>
FILE* fileopen();
void read_line(FILE*);
void read_line(FILE *fh){
char s[200];
double *input_re_see, *input_im_see;
double input_re, input_im;
if( fgets(s,sizeof(s),fh) != NULL) {
sscanf(s,"%lf %lf ", &input_re, &input_im);
// *input_re_see = input_re;
// *input_im_see = input_im;
// printf("%f %f ", *input_re_see, *input_im_see);
printf("input_re= %lf, input_im= %lf ", input_re, input_im );
printf("%s ",s);
}
}
FILE* fileopen(){
void *file = fopen("real.dat", "r");
if(file == NULL){
printf("Error opening file:");
}
return file;
}
int main(void) {
FILE *fh;
int i;
fh = fileopen();
for(i =0 ;i < 50 ; i++){
read_line(fh);
}
return 0;
}
WHat I am doing wrong with the pointer that causes segmentation fault, Please help.. Regards, Prady Last edited by user_prady; 02-08-2008 at 05:27 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|