|
Hi all
How to get a file's last modified time?
Thanks
|
|
|
|
|
Use the CreateFile Windows API function to get a handle to the file you wish to retrieve the date/time. Then use this function:
BOOL GetFileTime(
HANDLE hFile,
LPFILETIME lpCreationTime,
LPFILETIME lpLastAccessTime,
LPFILETIME lpLastWriteTime
);
Hope that helps
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
CFileStatus status;<br />
CFile::GetStatus("C:\\config.sys", status);<br />
CTime tm = status.m_mtime;
|
|
|
|
|
Dear All,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000.
I have a structure of format
//////////////////////////
struct ren
{
char src[150];
char desc[150];
};
//////////////////////////
I am fillng this structure with some values and then store this structure in a file for unfixed number of times (there may be more than
1000 entries and at same time no entry) during my program execution.
And at an click of event i read this file as
/////////////////////////////////////////////////
OFSTRUCT of;
HFILE hfile = OpenFile(RenFile,&of,OF_READ);
do
{
n=_lread(hfile,(char *)&ren,sizeof(ren));
....................................
....................................
....................................
}
while(n!=0);
_lclose(hfile);
/////////////////////////////////////////////////
This piece of code reads the structure from the beginning of file till END OF FILE structure by structure. Now I want to it to read the other way round!!
ie. I want to read the file from last structure to the beginning of file in an efficient manner.
ie.
if the file containts the entries
ram kali--------(1)
hari kumar--------(2)
lal singh --------(3)
the file should read 3 structure first , then second and then first.
Please send your useful suggestions.
Feel free to ask any further queries in this regards,
Thanks
Rohit Dhamija
|
|
|
|
|
MapViewOfFile.
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
"Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
What do u mean by this ?????
|
|
|
|
|
This is my Logo. No offence buddy -- You are C++ guy anyway.
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
lol
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Please go through the _lseek function
Thanx
TAKE CARE
|
|
|
|
|
do u want the algo ???
Thanx
TAKE CARE
|
|
|
|
|
no the algo , i just wanted to find some ways to accomplish the task and find out the most efficient way to do.
|
|
|
|
|
I am using
fseek( stream, 0L, SEEK_END);
fseek( stream, -sizeof(FileAdd), SEEK_CUR);
to go to the last structure and will then go the second last and so on....
Please suggest some other alternatives.
Rohit
|
|
|
|
|
One useful suggestion is that you can store your data in file with sort or indexing these data. Do you know how looks like indexed relation database?
|
|
|
|
|
Hi,
I'm a newbie at MFC and was wondering how I could accomplish putting a green border with round edges around buttons using VC++. You help is appreciated.
|
|
|
|
|
|
I looked at those. I was wondering is there a way I can put borders around the default buttons without having to create owner drawn buttons?
Thanks
|
|
|
|
|
nikimonkey wrote:
I was wondering is there a way I can put borders around the default buttons without having to create owner drawn buttons?
Not that I know of right off, but we're making one[^]. These controls will be fully skinnable, too.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
The simplest method is to drawing rectagle.
|
|
|
|
|
Hello, everyone!
Suppose I define a global variable in a .h file, for example,
"int counter", I want to know when the space of this variable is
allocated. I am not sure whether it is allocated when the .h file is
first included in another file or when the global variable is first
used in a specific function. Maybe allocated during compiling?
Can anyone help? Another question, when the space of this variable is
freed? Maybe the space of this variable is always existing during the
life of the whole program.
Thanks in advance,
George
|
|
|
|
|
Keep the use of global variables to a minimum. Many would even say never use them, but I believe they have their uses.
Global variables are declared in only one *.c/*.cpp file, not *.h files. If you want to access the global variable from another *.c/*.cpp file use the extern keyword. Use extern in *.h files also.
Space is allocated when the program runs, and is freed when the program exits.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks, PJ buddy!
You have correct one of my years-old mistakes in C/C++ programming. I have a further question. The extern key word is used only with variables and not with functions. Am I correct?
You have also said "Space is allocated when the program runs". Do you mean even if you do not use this variable in the program, the space is also allocated? And it is run-time allocation and not compile-time allocation. Am I also correct?
regards,
George
|
|
|
|
|
well well the word extern can be used with the function also.
mostly when a function is a global function its prototype have extern in it.
Yes the memory is allocated even if the Variable is not used in the program .
The allocation for such Variable is done Run-time
i hope this has solved ur query
Thanx
TAKE CARE
|
|
|
|
|
Hi, siid buddy!
Thank you for making me understand when the memory is allocated.
It seems most people do not support your opinion about "extern" keyword. What is your opinion?
regards,
George
|
|
|
|
|
No the extern keyword can be used with functions just declare as follows :
extern bool GetLength(char* str);
then you can call it like any other function.
|
|
|
|
|
Only as long as it is defined in another .cpp or.h file that the linker can link against
|
|
|
|