Thread: Windows Specific File I/O

  1. #61
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Code:
    LARGE_INTEGER li;
    GetFileSizeEx(hFile, &li);
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #62
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    Quote Originally Posted by Elysia View Post
    Code:
    LARGE_INTEGER li;
    GetFileSizeEx(hFile, &li);
    But using a LARGE_INTEGER for the file size causes alot of errors in the rest of the program.

    main.cpp: In function `int main(int, char**)':
    main.cpp:42: error: no match for 'operator/' in 'InputSize / FileCount'
    main.cpp:43: error: no match for 'operator%' in 'InputSize % FileCount'
    What is the easiest way to get around this? How do i convert a LARGE_INTEGER to a DWORD?
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

  3. #63
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Use the "QuadPart" section of the LARGE_INTEGER union.

    http://msdn2.microsoft.com/en-us/lib...13(VS.85).aspx

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #64
    Internet Superhero
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    964
    Quote Originally Posted by matsp View Post
    Use the "QuadPart" section of the LARGE_INTEGER union.

    http://msdn2.microsoft.com/en-us/lib...13(VS.85).aspx

    --
    Mats
    Thanks again, it's working now
    How I need a drink, alcoholic in nature, after the heavy lectures involving quantum mechanics.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM