|
You can send SW_HIDE to a window to make it hidden? That's completely new to me, i learn something every day, thanks.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Code-o-mat wrote: You can send SW_HIDE to a window to make it hidden?
Only if that window processes the WM messages and responds accordingly. Most standard window types in a dialog will do this.
|
|
|
|
|
ok
Best Regards,
Supriya Tonape
|
|
|
|
|
I have an ancient program that creates logs named using the time when they are created.
I need to delete the oldest files in the folder, only keeping the most recent 20, during runtime.
Is there any way to do this in C?
I can use Remove(filename), but then I have to go through each filename and compare dates. Seems like a hassle. Is there any function that returns the date of a file for comparison?
Thanks.
|
|
|
|
|
ChemmieBro wrote: Is there any way to do this in C?
Yes.
ChemmieBro wrote: Is there any function that returns the date of a file for comparison?
How about GetFileTime() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Your program has to check all the log files to find which 20 files are the latest. Then the program can delete all the old ones.
The program can get file times using CFileFind::GetLastWriteTime() (if you are using MFC). You said the filenames contain the time also. In that case you can also parse the filenames to get the times.
You can load the file times (together with the pathnames) into an array and sort them to find out the files that should be deleted. Sorting can be done easily by STL utilities.
Seems to be a hassle, but it's done by your program. The only hassle to you will be to write this program, just once. By using MFC and STL to implement this, it's not a big deal at all.
Good luck!
|
|
|
|
|
That's about what I thought. (parsing the names)
I'm stuck with standard C with no MFC support. This is an old, and very basic program, that I'm modifying. Looks like I'll just have to sort and use the Remove("filename.txt") function. Even with getting the file times, I'll still have to do some comparing/sorting.
I'm actually thinking of just changing the file naming to adding a number to the end of the file. Since there are only 20 or 30 files (whatever I choose), I'll just increment those each time and delete when there gets to be 31 in the folder... it is crude, but easy.
Thanks for the input. Thank goodness for programming advances since this was written...
|
|
|
|
|
Since your program creates log files names based on date and time, you can parse file names for the time when they were created. That would be better method, than finding the file's last write time.
|
|
|
|
|
just create a file with number like file1.txt,file2.txt ..... file20.txt.
after that, check like this,
for (int i=0;i<20;i++)
{
CString str;
str.Format(_T("file%d"),i);
if(!PathFileExists(str))
break;
DeleteFile(str);
}
if file doesn't exists then break the loop.
Regards,
Srinivas
|
|
|
|
|
Hai all,
I am searching one string (ex.Hello-Welcome) in text file using SQL query.
its searching Hello and Welcome seperatly and giving a result , i think bcoz hyphen(-) is a word breaker
in SQL .can any one give me the idea how to resolve the problem.
i need to use hyphen in searching string, and i need a combined string search result.
thanks
mahe
|
|
|
|
|
This does not appear to be a C++ question. You may get better visibility by posting in the General Database forum.
|
|
|
|
|
thanks
if u have any idea pls let me know.
|
|
|
|
|
You may escape the hyphen, see, for instance [^] (have a look at example "C. Using the ESCAPE clause").
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hi,
my project is a console application that it uses a ActiveX.
i did do this work with help of this article : Getting the most out of IDispatch[^]
but a problem:
myActiveX should not register in windows. and my console exe should load it (myActiceX) through a manifest. but this error occured:
This application has failed to start because mfc90ud.dll was not founcl. Re-installing the application may fix this problem.
please help me.
Zo.Naderi-Iran
|
|
|
|
|
Your application has a requirement to use the debug version of the MFC library. If this is not installed on the system you may need to install from your Visual Studio CD or get it from Microsoft.
|
|
|
|
|
when myActiveX has been registered, it will be debug and execute without any problem.
this error occurs through a manifest.
and mfc90ud.dll is in C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugMFC_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_2a62a75b
Zo.Naderi-Iran
|
|
|
|
|
zon_cpp wrote: this error occurs through a manifest.
Check your manifest file, or post it here. I have seen similar issues in the past when the contents of my manifest file was not correct.
|
|
|
|
|
i have to pass xml as string to dll
|
|
|
|
|
XMl is a format, it is not a data type. So, you can't "convert" from xml to string. If you have xml file, just read its content into a string and pass the string to your dll.
|
|
|
|
|
ya same thing i asked
i have no idea on how to read in a string
|
|
|
|
|
mailgirish99@yahoo.com wrote: i have no idea on how to read in a string
Are you serious? This is one of the most basic functions of programming. Try reading some of the MSDN pages on file handling, strings etc.
|
|
|
|
|
XML is basically a text file; so, use the CStdIOFile class to read the XML file and put that in a string.
me think it's kind of weird to pass a whole XML file as text to another function; but heck if that what is needed, so be it.
Are you certain you are not asked to pass the pathname/filename pointing to the XML file ?
This signature was proudly tested on animals.
|
|
|
|
|
hello every one
I am a beginner in c language
I am trying to print factorial of number using the program given below......
#include<stdio.h>
void main()
{
int fact=1,counter=5;
clrscr();
while(counter>0)
{
fact = fact * counter;
counter--;
}
printf("fact of %d is: %d",counter,fact);
getch();
}
I need output as
<b>Fact of 5 is 120.</b>
|
|
|
|
|
The program seems fine.
What is the error you are getting?
|
|
|
|
|
chaudhari.hemant1 wrote: printf("fact of %d is: %d",counter,fact);
You are trying to print the value of counter as 5, but you have decremented it in your loop so its value now is zero.
|
|
|
|