Coder's Guild Mailing List

Re: file open in C

Posted by Casey Deis on 2001-04-06

> Hey guys!
> 
> Have not posted this list for AGES!!
> 
> I would like to do the simplest of things in C which
> is open a file 
> using  fopen( ):
> 
> I keep getting access violations at the line
> concerned.  I know the syntax 
> must be correct as have
> lifted it from a previous project I was working on. 
> Any ideas on what to 
> look for??

I'm not familiar with fopen(), but I'm working on some
code now that uses it.  This code works as far as
fopen() is concerned, so here's excerpts from it that
may help you:

#include <windows.h>   //not sure which is required 
#include <stdio.h>     //for fopen()
#include <stdlib.h>

..

FILE *perlFile;

..

perlFile = fopen("c:\\tcsperltmp.txt", "r");


   
   if(perlFile == NULL)
   {
      return 1;
   }
    
Hope this helps.



__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/