Solved

'findfirst' in Borland C++ for Win32

Posted on 1998-08-20
4
1,718 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now