Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #105550
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Problems with lcc-win32 (trimmed) |
| Date | 2017-03-08 01:06 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <871su81ssa.fsf@bsb.me.uk> (permalink) |
| References | (4 earlier) <o9mdt2$r16$1@dont-email.me> <fafcf33b-a573-4610-b838-ba3e27554deb@googlegroups.com> <IXzvA.13541$Ip6.591@fx38.iad> <12e503a2-10a8-471f-bf38-42bff2230221@googlegroups.com> <o9n1j0$m10$1@dont-email.me> |
jacobnavia <jacob@jacob.remcomp.fr> writes:
<snip>
> Here is the code for fseeki64. Could you please compile that and see if it works?
>
> Thanks
> ------------------------------------------------------fseeki64.c
> #include <windows.h>
> #include <errno.h>
> #include <stdio.h>
> long long fseeki64(FILE *f,long long offset,int origin)
> {
> if (f == NULL)
> return -1;
> fflush(f);
> void *handle = (HANDLE)_get_osfhandle(_fileno(f));
> long result;
> long long r;
> LARGE_INTEGER Offset;
>
> if (handle == (HANDLE)-1) {
> errno = EBADF;
> return -1;
> }
> if (origin != 0 && origin != 1 && origin != 2) {
> errno = EINVAL;
> return -1;
> }
> memcpy(&Offset,&offset,sizeof(long long));
> SetLastError(0);
> result = SetFilePointerEx(handle,Offset,(PLARGE_INTEGER)&r,origin);
> if (result == 0) {
> errno = GetLastError();
> }
> return !result;
> }
> ----------------------------------------------------------------------
That's a strange bit of code. The strangest thing is the memcpy. I
can't see why you'd do that rather than write
long result = SetFilePointerEx(handle, offset, NULL, origin);
Presumably there is a prototype in scope so offset will be converted to
LARGE_INTEGER as if by assignment. If there is no prototype then
long result = SetFilePointerEx(handle, (LARGE_INTEGER)offset, NULL, origin);
would do, I think. Am I missing something?
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problems with lcc-win32 mertesthomas@gmail.com - 2017-03-05 14:12 -0800
Re: Problems with lcc-win32 luser droog <luser.droog@gmail.com> - 2017-03-05 14:46 -0800
Re: Problems with lcc-win32 gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-05 22:57 +0000
Re: Problems with lcc-win32 jacob navia <jacob@jacob.remcomp.fr> - 2017-03-06 00:49 +0100
Re: Problems with lcc-win32 luser droog <luser.droog@gmail.com> - 2017-03-05 22:10 -0800
Re: Problems with lcc-win32 BartC <bc@freeuk.com> - 2017-03-05 23:32 +0000
Re: Problems with lcc-win32 jacob navia <jacob@jacob.remcomp.fr> - 2017-03-06 00:48 +0100
Re: Problems with lcc-win32 jacob navia <jacob@jacob.remcomp.fr> - 2017-03-06 00:44 +0100
Re: Problems with lcc-win32 BartC <bc@freeuk.com> - 2017-03-06 00:13 +0000
Re: Problems with lcc-win32 Keith Thompson <kst-u@mib.org> - 2017-03-05 19:35 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 10:26 +0100
Re: Problems with lcc-win32 James Kuyper <jameskuyper@verizon.net> - 2017-03-06 07:08 -0500
Re: Problems with lcc-win32 Keith Thompson <kst-u@mib.org> - 2017-03-06 08:37 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 21:16 +0100
Re: Problems with lcc-win32 jm.bourguet@gmail.com - 2017-03-06 06:54 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 17:18 +0100
Re: Problems with lcc-win32 Keith Thompson <kst-u@mib.org> - 2017-03-06 08:42 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 21:19 +0100
Re: Problems with lcc-win32 jm.bourguet@gmail.com - 2017-03-06 08:44 -0800
Re: Problems with lcc-win32 David Brown <david.brown@hesbynett.no> - 2017-03-06 21:20 +0100
Re: Problems with lcc-win32 mertesthomas@gmail.com - 2017-03-06 00:24 -0800
Re: Problems with lcc-win32 jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-06 18:15 +0100
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-06 18:50 +0100
Re: Problems with lcc-win32 (trimmed) mertesthomas@gmail.com - 2017-03-07 04:50 -0800
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-07 14:54 +0100
Re: Problems with lcc-win32 (trimmed) mertesthomas@gmail.com - 2017-03-07 06:20 -0800
Re: Problems with lcc-win32 (trimmed) scott@slp53.sl.home (Scott Lurndal) - 2017-03-07 15:02 +0000
Re: Problems with lcc-win32 (trimmed) mertesthomas@gmail.com - 2017-03-07 08:00 -0800
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-07 20:30 +0100
Re: Problems with lcc-win32 (trimmed) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-08 01:06 +0000
Re: Problems with lcc-win32 (trimmed) jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-08 12:17 +0100
Assigning a struct to an integer (Was: Problems with lcc-win32 (trimmed)) gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-08 11:40 +0000
Re: Problems with lcc-win32 (trimmed) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-08 11:51 +0000
Re: Problems with lcc-win32 (trimmed) Robert Wessel <robertwessel2@yahoo.com> - 2017-03-07 15:27 -0600
Re: Problems with lcc-win32 (trimmed) scott@slp53.sl.home (Scott Lurndal) - 2017-03-08 13:50 +0000
Re: Problems with lcc-win32 (trimmed) scott@slp53.sl.home (Scott Lurndal) - 2017-03-08 13:51 +0000
csiph-web