Solved

'findfirst' in Borland C++ for Win32

Posted on 1998-08-20
4
1,761 Views
Last Modified: 2009-12-14
  The 'findfirst' function (Borland C++ 5.02,Borland C++ Builder) returns WRONG results of file date and file time
when called for FA_LABEL attribute, i.e to detect disk's label. The same function used in 16 bit environment returns
correct results for both date and time.
   How could I in 32 bit program written in Borland C++ detect true date & time of disk label ? Perhaps I could do it in assembler subroutine ? Perhaps there are other functions to do it ?
by assembler subroutine
0
Comment
Question by:rainette
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 100 total points
ID: 1170728
If this is a bug in the Borland runtime library, you can use the API functions which should work.

The relevant APIs are
FindFirstFile or FindFirstFileEx
FindNextFile
and FindClose
0
 

Author Comment

by:rainette
ID: 1170729
Thank you, but the indicated functions do not give information on LABEL attribute (I've just consulted Borland HELP). I'll try nevertheless.  The best method would be to call a 16 bit
program (DOS application) but I am not able to prohibit DOS screen to appear (redirection
of stdout goes but this screen appears nevertheless). Do you know if this is possible ?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1170730
In Win32, FindFirstFile does not return the disk label. GetVolumeInformation returns it, but no date and time information.
0
 

Expert Comment

by:RandomCoolGuy
ID: 26043197
Just in case someone else comes across this, you can get the Date and Time of the file from the correct conversion of the Time attribute of the TSearchRec:

TSearchRec sr;

FindFirst(path, iAttributes, sr);

ShowMessage(path + "," +
                        DateTimeToStr(FileDateToDateTime(sr.Time)) + "," +
                        IntToStr(sr.Size));





0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question