|
CFile myfile();<br />
myfile.GetStatus()<br />
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
In case of Windows API, use GetFileTime .
In case of MFC, use CFile::GetStatus .
In case of run-time C++ libraries, use fstat , perhaps combined with fileno .
|
|
|
|
|
and see here
<br />
WIN32_FIND_DATA lp;<br />
FILETIME Time;<br />
SYSTEMTIME stSystem;<br />
<br />
HANDLE handle=FindFirstFile(filename,&lp);<br />
FileTimeToLocalFileTime(&lp.ftCreationTime,&Time);<br />
FileTimeToSystemTime(&Time,&stSystem);<br />
<br />
stSystem.wDay, stSystem.wMonth, stSystem.wYear<br />
FindClose(handle);<br />
whitesky
|
|
|
|
|
Can i compare entire filetimes.. SO for example...
Can i check to see if stSystem > some other date? Make a comparison that is.
|
|
|
|
|
|
When refreshing an HTML page with <object..> which is a MFC based ActiveX:
Works fine. But on each Refresh of the page (or navigating away and back to the page) an ASSERT occurs in CWnd:Createex. When ignored, very strange behavior starts (missing window painting, mouse events not handled...)
Replicated with a newly created MFC ActiveX in VS 2005.
Replicated by compiling in VS 2005 the source of a MFC ActiveX that worked fine
Replicated if run from within VS (debug/release) or just using the IE.
Environment:
IE6, SP2.
XP SP2
Any ideas?
Dani
|
|
|
|
|
i have written a program wherein would like to open the selected file in its defalut application. i have been able gather the name of the file with the path but i am unable to find a way launch it in its default application.
please help
|
|
|
|
|
|
See ::ShellExecute(NULL, "open", "iexplore.exe", "0.htm", NULL, NULL, SW_SHOWNORMAL); maybe it is some helpful to you
whitesky
|
|
|
|
|
|
toxcct wrote: suss:
diff is just 2 min... thats considerable
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
i dont like that you i like you
whitesky
|
|
|
|
|
not what i was expressing (don't worry, i like you too )
i actually meant that you call shellExecute to start iexplore.exe manually and passes it the html file to be opened.
it's not how things should be done.
firstly, if you open IE, you will always get IE opened, even if it's not the default browser (which is not what the OP was looking for).
secondly, in a general mean, don't directly open the exe associated. only "open" the file, and ShellExecute() finds itself the default program associated to launch such a file...
see what i mean now ?!
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
thank you for information
now toxcct wrote: see what i mean now ?!
very good one one
and i hope that i see VisualCalc(4.0)
|
|
|
|
|
|
I use fopen(fp, "r+") to update the file
I find the key which I want to update (with fgets())
now i print with fprintf("%s\n"),
It just override the old text,
but not open new line.
RutR
|
|
|
|
|
You can't. The only way to do it is open a temporary file, copy up to the line you wish to add, copy the new line, then copy the rest of the file. Then, delete the original file and rename the new one with the original name.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
It's a suggestion to provide you one more option about what you can do .Take the contents of a file (if the size is small )and put it in a buffer. Create some space by shifting the buffer with the length of your string. Copy your string to the emptied space and then save it to the file
Otherwise you will have to proceed the way Cedric suggested
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I need some help with debugging in VS8. I've got a vector of pointers, and at some point during runtime my vector goes null (which I need it not to do). I'd like to be able to break in the code as soon as that vector variable changes so I can figure out where it's being cleared. Is there a way to tell the compiler to break when a variable's value has changed? I cannot fully trace the call stack because the code is being called through COM (this is from a C# GUI to unmanaged C++ code). Any help would be appreciated. Thanks.
|
|
|
|
|
Look up 'data breakpoints' in the help.
Data breakpoints allow you to break execution when the value stored at a specified memory location changes.
You can set data breakpoints in break mode only.
Addresses of variables change from one debugging session to the next. For this reason, data breakpoints are automatically disabled at the end of each debugging session. If you attach a data breakpoint to a local variable, the data breakpoint remains enabled when the function ends. The memory address it is attached to no longer has the same meaning, however, so the results of such a breakpoint are unpredictable. If you set a data breakpoint on a local variable, it is best to remove or disable it before the function ends.
Visual Studio currently supports setting four data breakpoints per project.
How to Set a Memory Change Breakpoint
1. From the Debug Menu, choose New Breakpoint and click New Data Breakpoint
—or—
in the Breakpoints window Menu, click the New dropdown and choose New Data Breakpoint.
The New Breakpoint dialog box appears.
2.In the Address box, enter a memory address or expression that evaluates to a memory address. For example, &foo to break when the contents of variable foo change.
3.In the Byte Count box, enter the number of bytes you want the debugger to watch. For example, if you enter 4, the debugger will watch the four bytes starting at &foo and break if any of those bytes change value.
4.Click OK.
--
The Obliterator
|
|
|
|
|
You are going to need to break when the memory changes. Based on your description, my suspiscion is that something is writing to memory it doesn't own.
Do you have a pointer to the vector of pointers, or is this the actual object and its data element (the array of pointers) is going null at some point?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello everyone,
I heard that page based I/O can improve performance, so some guys developed some page based I/O library which reads a file in page unit. For example, when we read the first byte, they will read an entire page (for example, 4k bytes) into memory, then when we are seeking to some other bytes inside a page, the bytes can be found from the page loaded in memory.
But, I also heard that when accessing OS File I/O, OS File I/O library implements page based I/O internally, for example, when you just read a byte using fseek or something, it will reads a whole page (maybe 4k or something) into memory.
My question is, which is true (OS provides page based I/O internally or not)? If OS provides page based I/O, why some guys always say that they are using page based I/O to improve performance.
thanks in advance,
George
|
|
|
|
|
This is one of those times where the code in question has been written and refined over many, many years. Improving hard drive access times is something that's always being improved. Let the OS and the hard drive do the cacheing for you.
If you want more details, search Channel9 for the interview with Molly Brown - she talks a lot about kernel mode memory and she discussed cacheing.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thank you Michael!
Do you mean OS have already provide page based buffer functions?
regards,
George
|
|
|
|
|
In general, reading files in multiples of the disc sector size will offer a slight speed improvement. In the real world, an application has to be very disc bound to notice the difference since most hard drives and the OS itself do caching.
My own experience is that for streaming data, reading/writing files in multiples of the sector and page size, usually 32k chunks, offers the best performance.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|