|
Hi all,
I'm looking for a function that can delete files by means of a wild card.
Is there such a functionIf so, can anyone please provide some more informationMany Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I do not think that there is a standard Win32 API function do to that. You would need to enumerate items using the wildcard and then delete matching items one by one.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks James, do you know wheter a standard command exists to perform my previous asked question over FTP.
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Only Command found: DELE - Delete file.
But this won't do the job ... Thanks anyway James
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Use SHFileOperation() .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi David, I have tried the following:
SHFILEOPSTRUCT wildcards;
wildcards.wFunc = FO_DELETE;
wildcards.hwnd=NULL;
wildcards.pFrom=(LPCTSTR)lpUpDownFiles[first].szUpFName;
wildcards.fFlags=FOF_FILESONLY;
SHFileOperation(wildcards);
But get the following error:
Error 7 error C2664: 'SHFileOperationA' : cannot convert parameter 1 from 'SHFILEOPSTRUCT' to 'LPSHFILEOPSTRUCTA'
Can you please help?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
The compiler is telling you the problem. SHFileOperation() is expectnng a pointer (to a SHFILEOPSTRUCT ).
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
No memory has been assigned to lpFileOp . Why aren't you using:
SHFILEOPSTRUCT lpFileOp = {0};
lpFileOp.wFunc = FO_DELETE;
lpFileOp.pFrom = (LPCTSTR)lpUpDownFiles[first].szUpFName;
lpFileOp.fFlags = FOF_FILESONLY;
SHFileOperation(&lpFileOp);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi David ... What would I do in the following instance:
Run-Time Check Failure #3 - The variable 'lpFileOp' is being used without being initialized.
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
|
|
LOL the compilers telling you the answer but you won't take the time to stop and read it...too funny!;P
Yours Truly, The One and Only!
|
|
|
|
|
Can we find out the size of a structure without using sizeof function?
I have tried to write a macro passing the name of the structure as a parameter, but it did not work as expected!! Is there anyother way to do this?
Please provide your valuable suggestions and code(if possible).....
R@j@$eg@r
|
|
|
|
|
Yes.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Homework-time, eh?
Hint: You can get adresses of struct members...
Failure is not an option - it's built right in.
|
|
|
|
|
Even sizeof usage is hazardous on Win32 structures.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Why?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Since we are working on generating metadata about a structure by supplying the name of the structure, and getting its size during run time!!
R@j@$eg@r
|
|
|
|
|
This makes no sense. How does it answer the question, "Why is sizeof usage hazardous on Win32 structures?"
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hint: BITMAPINFO
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Is its size undetectable?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Of course it is detectable. But its actual size cannot be detected with a naive use of sizeof , i.e. it's tricky!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I agree. sizeof will return different size for the same structure if executed in different platforms i.e linux vs windows and thus different compilers. This is due to padding and alignment of members for optimization purposes in the memory. There are macros or compiler options that can be used to eliminate padding i.e to use 1 byte padding always. If i remember correctly this will be the "pack(1)" macro and in Visual C++ the compiler option /Z1 (I think) can be used to force 1 byte padding. This will give more consistent results with sizeof... .
|
|
|
|
|
Emmanouil wrote: I agree. sizeof will return different size for the same structure if executed in different platforms i.e linux vs windows and thus different compilers.
I'm not exactly sure what you are agreeing to, but, for example, sizeof(int) will also return different results on different platforms. That's not a fault with the sizeof operator, however.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|