|
use
BOOL DeleteFile(
LPCTSTR lpFileName
);
|
|
|
|
|
Thanks. But I also need to check that it exists. Or can I just blindly delete it even if its nonexistent? I think that might not work> Is there a FileExists kind og function thats available?
Appreciate your help,
ns
|
|
|
|
|
CFile::GetStatus() .
Damn, you're really making me feel bad! My FileSystem class (as yet unposted at CP) does all this and more!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hey stranger!
Thanks for the GetStatus. Hows the new project coming along?
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Hows the new project coming along?
Cool!
Btw, contrary to what someone replied, you need to check if the file is readonly - if so, modify its attributes (use CFile::SetStatus ) before deleting it - or at least warn the user. Damn, I reeeeely should post that FileSystem class at CP! Its deleteFile() method has a bool bForce arg that will take care of this.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
CFile::GetStatus()
_access(...) is another way to do it!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
|
You can delete it even if it doesn't exist. Don't worry about DeleteFile, it won't crash your program if the file doesn't exist...well maybe on 98
Chris Richardson
|
|
|
|
|
Sounds like what you really want to do is use CreateFile with CREATE_ALWAYS.
|
|
|
|
|
Whilst looking at my MFC CWnd window, I often just fiddle with the mouse wheel out of boredom.. however my window has a slider control class on it, and if I've just moved the slider then fiddling with the wheel will make it move.
I would like to put in some kind of handler for the main CWnd so that if the user clicks anywhere in the window that isn't a control, the focus is given to the window and not the control.
Which handler do I use? CWnd::OnMouseActivate() doesn't quite seem to work in the way I want...
Thanks,
____________
Smidge
|
|
|
|
|
Hmmm, by wanting to have *no* child window have focus when the user clicks in an "empty" part of the window, you'll likely confuse your users by overriding Window's standard behavior (i.e. remembering which child window has focus).
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm aware of what the window behaviour would be like, but this would not cause major problems..
Do you know which message I should handle? Thanks,
|
|
|
|
|
I think you'd need to handle WM_SETFOCUS and WM_LBUTTONDOWN in PreTranslateMessage() . Good luck! I'd be curious to know how it works out.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I dont want to have duplicate entries, but I dont want any sorting either. I was using a set but it wont work for me since it sorts. A vector doesnt sort, but allows duplicates. Is there a container that will neither allow duplicates, nor sort?
Appreciate your help,
ns
|
|
|
|
|
You could use a set and specify your own sorting function, one that does nothing.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
specify your own sorting function, one that does nothing.
Did you actually tried this one yourself?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
No, and after thinking about it on the bus, I decided it would not work.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
hash_set
|
|
|
|
|
You could implement a two-step insertion with find() and insert() on a vector. In other words, you search for an item before inserting a new item.
Kuphryn
|
|
|
|
|
many thanks for the suggestions - I now have so many options!
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Is there a container that will neither allow duplicates, nor sort?
Isn't that map ?
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I've used map just for sorting, so not map.
Appreciate your help,
ns
|
|
|
|
|
hash_set is what you want. Unfortunately, this container is not standard. I think STLPort has it, though.
Check here[^] for info about hash_set s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
VC7 has it though.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Oh, didn't know about it... After having a look at the docs, seems like this hash_set does not serve the needs of ns, since it requires that the elements be ordered --SGI's hash_set , on the other hand, only demands an equality predicate (with the disadvantage or poorer performance, I guess).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|