Solved

'findfirst' in Borland C++ for Win32

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

770 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