Re: can't read sequential files

2007-11-01 Thread Lewis Hyatt
Hang on, I misread you, my eye skipped over the bit where you suggest that adding the check somehow makes the preceding fopen call succeed instead of fail. However I still don't think that's what the OP was saying, unless the subject line of this thread is terribly wrong, I think you just read

RE: can't read sequential files

2007-11-01 Thread Dave Korn
On 01 November 2007 15:58, Dave Korn wrote: > On 01 November 2007 15:15, Lewis Hyatt wrote: > > if (fp==NULL) { printf("error, NULL pointer!\n"); return(1); } > >> I think what the OP is saying is that if he adds the check for null, >> then his code

RE: can't read sequential files

2007-11-01 Thread Dave Korn
On 01 November 2007 15:15, Lewis Hyatt wrote: >>> if (fp==NULL) >>> { >>>printf("error, NULL pointer!\n"); >>>return(1); >>> } > I think what the OP is saying is that if he adds the check for null, > then his code works normally, including the file read operation, (ie

Re: can't read sequential files

2007-11-01 Thread Lewis Hyatt
Dave Korn wrote: On 01 November 2007 06:43, zirtik wrote: After adding the line: if (fp==NULL) { printf("error, NULL pointer!\n"); return(1); } and then rebuilding the code, everything worked. But it's strange that if I delete that code segment a

RE: can't read sequential files

2007-11-01 Thread Dave Korn
On 01 November 2007 06:43, zirtik wrote: > After adding the line: > > > if (fp==NULL) > { > printf("error, NULL pointer!\n"); > return(1); > } > > and then rebuilding the code, everything worked. But it's strange that if I > delete that code segment and never

Re: can't read sequential files

2007-10-31 Thread zirtik
After adding the line: if (fp==NULL) { printf("error, NULL pointer!\n"); return(1); } and then rebuilding the code, everything worked. But it's strange that if I delete that code segment and never check whether the fp pointer is NULL or not, I alwa

Re: can't read sequential files

2007-10-31 Thread Larry Hall (Cygwin)
Alberto Luaces wrote: Maybe unrelated, but: shouldn't this fp = fopen ("phi.txt","r"); be fp = fopen ("phi.txt","rt"); ? It's not required, no. -- Larry Hall http://www.rfk.com RFK Partners, Inc. (508) 893-9779 - RFK Office 216 Dalt

RE: can't read sequential files

2007-10-31 Thread Dave Korn
On 31 October 2007 00:11, zirtik wrote: > int i; > fp = fopen ("phi.txt","r"); > > for( i = 0; i < 51; i++ ) { > fscanf(fp, "%d\n", &original_phi[i]); > } > 655 [main] Genetics 3012 _cygtls::handle_exceptions: Exception: > STATUS_ACCESS_VIOLATION > 2540 [mai

Re: can't read sequential files

2007-10-31 Thread Alberto Luaces
Maybe unrelated, but: shouldn't this > fp = fopen ("phi.txt","r"); be fp = fopen ("phi.txt","rt"); ? -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ:

Re: can't read sequential files

2007-10-30 Thread Brian Dessent
zirtik wrote: > and when I try to compile it, it compiles well, but when I try to run it I > get the following error message: > > 655 [main] Genetics 3012 _cygtls::handle_exceptions: Exception: > STATUS_ACCESS_VIOLATION > 2540 [main] Genetics 3012 open_stackdumpfile: Dumping stack trace to > Gene

Re: can't read sequential files

2007-10-30 Thread Jim Marshall
zirtik wrote: Hi, I'm using cygwin and windows XP together with Eclipse IDE and CDT. I have a following piece of code: int i; fp = fopen ("phi.txt","r"); for( i = 0; i < 51; i++ ) { fscanf(fp, "%d\n", &original_phi[i]); } ...