Hello,
I tried to find the access time of a file using stat() function.
but the following C code in windows vc.net 2003 always give
the same access time. the same code works correctly in linux gcc.
do I miss something?
#include <stdio.h>
#include <sys/stat.h>
int main() {
struct stat sbuf;
char *name="testfile ";
FILE *fd;
char result[100];
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fd = fopen(name, "r");
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fread(result, 3,1, fd);
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fclose(fd);
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
return 0;
}
thanks. 6 1368 on********@yaho o.com wrote:
I tried to find the access time of a file using stat() function.
but the following C code in windows vc.net 2003 always give
the same access time. the same code works correctly in linux gcc.
Is the volume formatted with NTFS?
Eberhard Schefold wrote:
on********@yaho o.com wrote:
>I tried to find the access time of a file using stat() function. but the following C code in windows vc.net 2003 always give the same access time. the same code works correctly in linux gcc.
Is the volume formatted with NTFS?
Under C, it is NTFS.
Under D, it is fat32.
but I run the program under C drive.
Eberhard Schefold wrote:
on********@yaho o.com wrote:
>I tried to find the access time of a file using stat() function. but the following C code in windows vc.net 2003 always give the same access time. the same code works correctly in linux gcc.
Is the volume formatted with NTFS?
tried unde pure NTFS windows XP SP 2,
the same problem. the access time is never changed.
<on********@yah oo.comwrote in message
news:ep******** ******@TK2MSFTN GP03.phx.gbl...
Eberhard Schefold wrote:
>on********@yaho o.com wrote:
>>I tried to find the access time of a file using stat() function. but the following C code in windows vc.net 2003 always give the same access time. the same code works correctly in linux gcc.
Is the volume formatted with NTFS?
tried unde pure NTFS windows XP SP 2,
the same problem. the access time is never changed.
Have you used any registry tricks to improve NTFS performance? Not
generating short filenames and not updating access times are two favorites
for saving cycles.
Have you used any registry tricks to improve NTFS performance? Not
generating short filenames and not updating access times are two favorites
for saving cycles.
Not sure which registry value to look for not generating short filenames
or not updating access time?
are you able to run the following code successfully in windows xp
with different access time?
#include <stdio.h>
#include <sys/stat.h>
int main() {
struct stat sbuf;
char *name="c:\\wind ows\\win.ini";
FILE *fd;
char result[100];
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fd = fopen(name, "r");
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fread(result, 3,1, fd);
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
fclose(fd);
if(!stat(name, &sbuf) )
{
printf("atime = %d\n", sbuf.st_atime);
}
return 0;
}
<on********@yah oo.comwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
>
>Have you used any registry tricks to improve NTFS performance? Not generating short filenames and not updating access times are two favorites for saving cycles.
Not sure which registry value to look for not generating short filenames
or not updating access time?
are you able to run the following code successfully in windows xp
with different access time?
Yes and no:
atime = 1163171213
atime = 1163171213
atime = 1163171213
atime = 1163175949
Second run:
atime = 1163175949
atime = 1163175949
atime = 1163175949
atime = 1163175949
See also http://technet2.microsoft.com/Window....mspx?mfr=true
and search for "Last Access Time".
Indeed, _fstat works considerably better, changing once per second. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paulo Pinto |
last post by:
I am doing an application that needs to
know when it is manipulating symbolic links.
But it is failing to reckognize them.
If I run the following code:
<code>
import sys
import os
|
by: Steven T. Hatton |
last post by:
I found the following two statements in the file linked below:
struct stat st;
stat(fileName.c_str(), &st);
http://websvn.kde.org/branches/work/kdevelop4-parser/main.cpp?rev=420247&view=markup
This is from /usr/include/sys/stat.h which I'm pretty sure is what #include
<sys/stat.h> is pulling in. I plain and simply do not understand what the
above two lines of code do. Can someone please explain?
|
by: diadia |
last post by:
#include <sys/types.h>
#include <sys/stat.h>
#include "ctype.h"
#include <stdio.h>
int estimateLen(struct stat buf, FILE *fp)
{
size_t _size = buf.st_size / 4;
|
by: David Bear |
last post by:
I'm trying to use os.chmod and am refered to the stat module.
Is there are explanation of:
* S_ISUID
* S_ISGID
* S_ENFMT
* S_ISVTX
* S_IREAD
* S_IWRITE
* S_IEXEC
|
by: cedarson |
last post by:
I am writing a program and have been instructeed to use the 'fseek',
'ftell', and 'stat' functions, however, after looking in the online
manual for each of these, I am still unsure on how to use them. In my
program, I am to write a code that opens a file, uses 'stat' to
determine the file size, use 'fseek' to move the offset of the pointer,
and finally use 'ftell' to obtain the file pointer index. Will someone
please help? Again, thanks...
| |
by: Hansen |
last post by:
Hi Group,
I've made a statistic module for our framework, and have put it in a
namespace called stat (which resides in a namespace called dao)
My problem is that now the compiler thinks that it is the struct called stat
from wchar.h that I'm refering to even though I've written
dao::stat::stat_base
I have included the stat_base.h header and have checked for using
statements, but nothing seems to work.
|
by: Joe Salmeri |
last post by:
I just upgraded from Python 2.4.2 to Python 2.5.1 and have found some
unexpected behavior that appears to be a bug in the os.stat module.
My OS is Windows XP SP2 + all updates.
I have several programs that have worked flawlessly on all previous Python
versions for years and they are now producing incorrect results in the code
that uses os.stat.
Searching through the 2.5.1 release notes I found the following:
|
by: Alona |
last post by:
Hi All,
stat fails on a 2GB file with errno=EOVERFLOW.
Is there a way to run stat() on a large file?
Thanks,
Alona
|
by: Deniz Dogan |
last post by:
Hello.
I have a question regarding the st_mode field of the "stat" struct in
sys/stat.h. I'd like to know how to use the S_IRWXU, S_IRWXG and
S_IRWXO flags to mask the mode_t value into human readable form such
as 755, 644, etc. Currently I do something similar to this:
usr_t = (mod & S_IRWXU);
usr_r = (mod & S_IRUSR);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |