Solved

'findfirst' in Borland C++ for Win32

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

706 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

19 Experts available now in Live!

Get 1:1 Help Now