[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem with string.format %d and very large integers
- From: Thomas Lauer <thomas.lauer@...>
- Date: Wed, 17 Aug 2011 21:16:30 +0100
Dimiter 'malkia' Stanev <malkia@gmail.com> wrote:
>
> How do you handle the case where SEEK_END is used? I was looking for
> function in this case to get me the file length in 64-bits, but could
> not find any... (there is no ftello, that returns off_t, instead of long
> which is 32-bit in my case).
I am currently far away from my developments machines, so I gotta rely
on memory and Google. There are two CRT functions involved, fileno() to
go from *FILE to file descriptor and _filelengthi64() which takes a file
descriptor and returns the file length. Something like this:
flen=_filelengthi64(fileno(fh)); // fh is a stream
HTH
--
cheers thomasl
>
> The only 64-bit functions are for file handles, not FILE*.
>
> Thanks,
> Dimiter "malkia" Stanev.
>
> On 8/6/2011 3:22 AM, Thomas Lauer wrote:
> > malkia<malkia@gmail.com> wrote:
> >>
> >> Thank you for the information. I saw that fpos_t is int64 anywhere
> >> (32-bit, 64-bit), which is great news.
> >> I wonder how I skipped that function (I've never even heard about it -
> >> fsetpos/fgetpos).
> >>
> >> Gotta try it on XP whether it works.
> >
> > Well, it works here. I basically use the same method to link against
> > MSVCRT.DLL as you do (ie linking with msvcrt_win2000.obj) and so far,
> > these functions do the job. (Though I readily admit that most files I
> > work with are smaller than 4gb. But all the 4gb+ tests I did were OK.)
> >
> > If you find problems with that approach, it'd be nice if you reported
> > back.
> >