|
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.
|
|
|
|
|
void main()
{
clrscr();
int fact=1, counter=5;
int term = 1;
while(term <= counter)
{
fact = fact * term;
term++;
}
printf("fact of %d is: %d", counter, fact);
getch();
}
modified on Saturday, December 12, 2009 4:55 AM
|
|
|
|
|
And just how does this loop end?
while(counter <= counter)
Perhaps you meant
while(term <= counter)
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
yes. sorry.
the code has been edited.
|
|
|
|
|
#include < stdio.h >
void main()
{
int counter,fact=1,num=5;
counter = num;
clrscr();
while(counter > 0)
{
fact = fact * counter;
counter--;
}
printf("fact of %d is: %d",num,fact);
getch();
}
|
|
|
|
|
dear brother, can you tell me how to hook the messages of a short-cut menu?
for example, the short-cut menu on the desktop
|
|
|
|
|
Menu commands are sent using WM_COMMAND .
You should be able to intercept them using SetWindowsHookEx with WH_CALLWNDPROC .
|
|
|
|