CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2000
    Posts
    196

    fopen vs. fopen64

    Hello

    To be able to open large logfiles in a software, I change the necessary "fopen"-command to "fopen64". This procedure works and is described in a patch, too. However when I compile it I get some warnings:
    --> In function `main':
    --> warning: implicit declaration of function `fopen64'
    --> warning: assignment makes pointer from integer without a cast


    Before patching I had:
    Code:
    FILE    *log_fp;
    ...
    log_fp = fopen(log_fname,"r");
    After patching:
    Code:
    FILE    *log_fp;
    ...
    log_fp = fopen64(log_fname,"r");
    How can I avoid that warning???

  2. #2
    Join Date
    Apr 1999
    Posts
    50

    Re: fopen vs. fopen64

    Quote Originally Posted by frei
    Hello

    To be able to open large logfiles in a software, I change the necessary "fopen"-command to "fopen64". This procedure works and is described in a patch, too. However when I compile it I get some warnings:
    --> In function `main':
    --> warning: implicit declaration of function `fopen64'
    --> warning: assignment makes pointer from integer without a cast


    Before patching I had:
    Code:
    FILE    *log_fp;
    ...
    log_fp = fopen(log_fname,"r");
    After patching:
    Code:
    FILE    *log_fp;
    ...
    log_fp = fopen64(log_fname,"r");
    How can I avoid that warning???
    I assume you are using C rather than C++. In C, if you call an undeclared function, the compiler assumes it returns an int, and then complains that you are converting the int to a pointer. The fopen64 routine is specific to Linux; if that is what you are using, make sure you are including the righr headers.

    Hope that helps.

  3. #3
    Join Date
    Mar 2000
    Posts
    196

    Re: fopen vs. fopen64

    Yes, I'm using C, not C++.

    The function is declared: I have the stdio.h header included (#include <stdio.h>).

    The program works, but I get the above warnings when I use fopen64 instead of fopen...

    I really don't know why... Does someone have an idea to get rid of the problem??
    Last edited by frei; June 16th, 2006 at 11:13 AM.

  4. #4
    Join Date
    Jan 2007
    Posts
    1

    Re: fopen vs. fopen64

    You need to compile with -D_LARGEFILE64_SOURCE option.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured