🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #877

Re: Cannot retrieve file date

#877
From: Ed Mulroy [TeamB]
Date: Wed, 02 Jan 2008 23:30
73 lines
4316 bytes
> Something new for me. I would never have thought of searching
> for a function named _get_osfhandle().

That function seems to be little-known.  I have needed it only rarely but 
when I do it has bailed me out of many tough situations.  It is provided by 
the compiler but is considered an "extension" because it not part of the 
official C or C++ languages.


There are many types of file handle.

The C and C++ languages define a FILE* pointer which is associated with 
opened files.  Programmers commonly call it a file handle.

Another set of I/O routines supplied with the compiler 
(open/read/write/close) use a file handle which is a number, an integer. 
These are used very little these days but long ago were frequently used.

The operating system uses its own file handling system.  As the C and C++ 
languages were created to be reasonably independent of which operating 
system is being used the languages implement their file systems using those 
of the operating system.

C and C++ provide no facilities for reading file times so to perform your 
task you needed to step down to a lower level and use the operating system 
(the OS) itself.

API stands for Application Program Interface, a set of schemes, usually 
functions to call, provided by something.  The Windows API is often called 
the WIN32 API (the 32 because Windows is 32 bits these days but years ago 
the API was smaller, a little different and Windows was only 16 bits).

Help files cover the languages and those extensions provided that are not 
part of the official language.

When dealing with the native OS information is typically found in a 
different help file.  In this case that help file is the WIN32 API help 
file.  Using it is analagous to the separate documentation you used in the 
DOS days for Dos and BIOS interrupt calls and information structures such as 
the DOS List of Lists or BIOS list of serial ports.

Do not make the mistake of thinking the help files can teach you the 
language or the Windows API.  The help files are intended as references and 
not as tutorials.  For learning look around on the web for tutorials and 
look at books.

Links to C++ tutorials and a (old) copy of the C++ standard:
  http://www.mulroy.org/programg.htm#cpptutor

Links to other tutorials, including some WIN32 API tutorials:
  http://www.mulroy.org/programg.htm#othertutor

Links to other informative sites about Windows including the WIN32 API
  http://www.mulroy.org/programg.htm#win32

If for some reason you cannot find the help file for the WIN32 API, this 
link (at least used to be) where you can get a copy of it:
  http://www.winasm.net/index.php?ind=downloads&op=entry_view&iden=23

.  Ed

> Jos� wrote in message
> news:f05on3tbpa6au45ii99v71rsn5k89d2ut7@4ax.com...
>
>>  return (HANDLE) _get_osfhandle(fileno(fp));
>
> Something new for me. I would never have thought of searching for a
> function named _get_osfhandle(). The help file explains that there is
> a difference between an "operating system file handle" and a "run-time
> file handle". It should not be too simple.
>
> Oh dear, assembly was so easy, I used it a lot in the time of good old
> DOS.
Technical Details
Message-ID: <477c1ea9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <hfonn3l8o175ht0j11i9d4q5msanpr6apt@4ax.com> <477c0a92$1@newsgroups.borland.com> <f05on3tbpa6au45ii99v71rsn5k89d2ut7@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4011bf1b28cc5925
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII
From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <hfonn3l8o175ht0j11i9d4q5msanpr6apt@4ax.com> <477c0a92$1@newsgroups.borland.com> <f05on3tbpa6au45ii99v71rsn5k89d2ut7@4ax.com>
Subject: Re: Cannot retrieve file date
Date: Wed, 2 Jan 2008 18:30:43 -0500
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.77.53.190
Message-ID: <477c1ea9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1199316649 71.77.53.190 (2 Jan 2008 15:30:49 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail