Thread: Calling function a function to do fopen

  1. #1
    Registered User
    Join Date
    Jun 2006

    Calling a function to do fopen

    Hi, I'm having some troubles with openning a file that I need to read. I think it's because I'm handling the FILE* wrong or something. But I'm a little confused about this. Hopefully someone can clarify it a bit for me please.

    Basically I have a function that I call from a calling function in another source file to open a ttext file. I've got all the extern stuff working so that it compiles and all. The relevant part for my open file function is below.
    int Open (FILE** FileStream) {
    *FileStream = fopen (/*path and mode here*/);
    In my calling function, I declare a FILE* variable and pass it to Open like so.

    FILE* FileStream;
    int i;

    i = Open (&FileStream);

    But when I run the program, it says can't open the file. So what exactly is wrong with the way I'm passing the FileStream to the Open function? Thanks a lot for your help.
    Last edited by fanoliv; 06-19-2006 at 01:28 PM.

  2. #2
    Registered User
    Join Date
    Jun 2006
    Sorry to bother you guys. I figured out the problem is in another part of the program, which I was passing the wrong file name to fopen. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  3. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
Website Security Test