Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
23rd November 2014, 13:43 | #21 | Link | ||
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
It appears to be available in VS 6.0: http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx Code:
#include <sys/stat.h> __int64 getFileSize64(FILE *const fp) { struct _stati64 stat; if(_fstati64(_fileno(fp), &stat) != 0) { return -1; /*some error occurred*/ } return stat.st_size; } Quote:
It is returned as an intptr_t, but you can typecast to HANDLE safely. I would still prefer the fstat()-based solution, since it's cross-platform.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 23rd November 2014 at 14:02. |
||
23rd November 2014, 17:23 | #22 | Link | ||
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Thanx everybody for input, I shall investigate all (bit busy doing something else at the moment).
Quote:
Quote:
EDIT: Perhaps you meant something like, Code:
sum += ((BYTE*)srcp)[x+0]; sum += ((BYTE*)srcp)[x+1]; sum += ((BYTE*)srcp)[x+2]; sum += ((BYTE*)srcp)[x+3]; EDIT: I have SDK 2003 installed but can find no docs on _fseek64 and so thought it was not available, also searched include directory. It does exist in the src\crt\ directory (header and source) , dont know if that means that it is included in libs or not (I assume it is), I shall have to investigate.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 23rd November 2014 at 18:22. |
||
23rd November 2014, 17:32 | #23 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
And you don't need to link a special library for those CRT functions, because the VC linker will link against the suitable MSVCRTxxx.DLL automatically, unless you explicitly prevent linking of that library. The CRT headers should be in "VS_INSTALL_PATH\VC\include" (at least that's how it is with recent VisualStudio). Simply include <sys/stat.h> to get _fstati64(), for example.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 23rd November 2014 at 17:44. |
|
23rd November 2014, 17:55 | #24 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Windows search on SDK Include directory failed to find _fseek64, but looking into
"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\crt\sys\stat.h" It is there. (EDIT: All files and folders, search system files, search hidden files, search subfolders, case insensitive) Thank you mi'lud. EDIT: Just did search again, not found again ??? EDIT: And I really should read the VS documentation one day.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 23rd November 2014 at 18:04. |
23rd November 2014, 18:20 | #25 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
I think what you are looking for should be _fseeki64(), not _fseek64(). As a little extra challenge for us, Linux/glibc calls this fseeko64()
Also, any reason you prefer determining the file size using the _fseeki64() plus _ftelli64() "workaround" rather than calling _fstati64() right away? EDIT: I just noticed that the MSVC CRT even has a _filelengthi64() function, available in VC 6.0, which makes it even simpler Code:
#include <io.h> __int64 getFileSize64(FILE *const fp) { return _filelengthi64(_fileno(fp)); }
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 23rd November 2014 at 22:06. |
23rd November 2014, 18:35 | #26 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Oops yes, I meant _fseeki64, just re-did search again, still not found.
I was just looking for that one to get file location, wanted _ftelli64() too but did not search on that (EDIT: searched on that too, still not found). Also, thanx for the getFileSize64 thing, I had already located that one on net.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
23rd November 2014, 19:43 | #27 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
OK, think I'll give VS2008 another try,
perhaps that will placate the Fluffy one (why is he so angry, all of the time). Been having a few crashes lately due to trying a hack up of adb over USB for three Android devices, think I've screwed my registry and need to re-ghost or do fresh install, might as well get rid of all trace of VS6 and install 2008.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 26th November 2014 at 17:36. |
Tags |
file system, large file support |
|
|