Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6104123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:48:22+00:00 2026-05-23T13:48:22+00:00

I’m working on some code that needs to run on every version of windows

  • 0

I’m working on some code that needs to run on every version of windows since WIN2000 and also needs to work with wide file paths.

I need to call some variant of stat to get the file length. The file may be larger than 4GB.

Here’s the relevant section from the MSDN Visual Studio .NET 2003[1] documentation:


int _stat(
   const char *path,
   struct _stat *buffer 
);
int _stat64(
   const char *path,
   struct __stat64 *buffer 
);
int _stati64(
   const char *path,
   struct _stati64 *buffer 
);
int _wstat(
   const wchar_t *path,
   struct _stat *buffer 
);
int _wstat64(
   const wchar_t *path,
   struct __stat64 *buffer 
);
int _wstati64(
   const wchar_t *path,
   struct _stati64 *buffer 
);

[1] https://web.archive.org/web/20110506201149/http://msdn.microsoft.com/en-us/library/14h5k7ff(v=VS.71).aspx

I can’t figure out the difference between the __stat64 structure and the _stati64 structure. I know that I want to use _wstat64 or _wstati64 but MSDN is silent on which is better.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:48:23+00:00Added an answer on May 23, 2026 at 1:48 pm

    Here are the __stat64 and the _stati64 structures from the mingw wchar.h #include file:

    
    #if defined (__MSVCRT__)
    struct _stati64 {
        _dev_t st_dev;
        _ino_t st_ino;
        unsigned short st_mode;
        short st_nlink;
        short st_uid;
        short st_gid;
        _dev_t st_rdev;
        __int64 st_size;
        time_t st_atime;
        time_t st_mtime;
        time_t st_ctime;
    };
    
    #if __MSVCRT_VERSION__ >= 0x0601
    struct __stat64
    {
        _dev_t st_dev;
        _ino_t st_ino;
        _mode_t st_mode;
        short st_nlink;
        short st_uid;
        short st_gid;
        _dev_t st_rdev;
        __int64 st_size;
        __time64_t st_atime;
        __time64_t st_mtime;
        __time64_t st_ctime;
    };
    

    According to these structures, it seems that _stat64 is a better choice than stati64 because:

    1. st_mode is _mode_t and not unsigned short
    2. Time is expressed as a _time64_t and not a time_t, so it has the same range that can be expressed by the NTFS file system, and is not crippled to the 32-bit time_t.

    I’m still confused, but this seems closer to the correct answer.

    Notice also that the _stat64 requires MSVCRT_VERSION > 0x0601, which implies that it is more modern.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.