|
I am busy writing up an article for CP that just what you are asking for. I expect to have it ready for posting in a couple of days. If you send me your email address I can send you the demo code that I have ready so far. Then you can test it for me;P
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
In case you can't wait for the reply from PJ Arends.
Try this
http://www.codeproject.com/vcpp/stl/ostringstream.asp
(by Christian Graus)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
RemoveDirectory(LPCTSTR lpPathName);
is used for where the path must specify an empty directory, but i want to remove a directory and also the files and folders that are in the specified folder , how can do that?
as per MSDN
BOOL RemoveDirectory(LPCTSTR lpPathName);
lpPathName
[in] Pointer to a null-terminated string that specifies the path of the directory to be removed. The path must specify an empty directory, and the calling process must have delete access to the directory.
Regards.
|
|
|
|
|
Use SHFileOperation() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Would like to give me an example in what way it can be used for above said purpose
Regards.
|
|
|
|
|
Do you mean other than what Googling would show you?
SHFILEOPSTRUCT s = {0};
s.wFunc = FO_DELETE;
s.pFrom = "c:\\somedir\\anotherdir\\*.*\0";
SHFileOperation(&s);
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
|
Recursively iterate child directories and files, deleting the files first, and then deleting the empty directories left behind. Use DeleteFile to get rid of the files. See FindFirstFile, FindNextFile, and FindClose. Don't forget to ignore the '.' and '..' files while iterating all files within a directory.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
hai.. this is kiran...
I request all respectd peoples,pl give code or guideline regarding WAVEFILETOTEXT file in either SDK or MFC.
HAPPY VALEN
THANKU FOR ONE AND ALL.
|
|
|
|
|
i don't understand...
how would you convert a wave file (which basically describes a signal) into text file (which is for beeing read)... ?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
i guess that basically needs speech recognition. when you are able to recognize a speech, then what's the problem converting them to text?
VuNic
|
|
|
|
|
Hi ,
I am having problem sending CString data more than 255 character length to my Database Table through CRecordset class.
I hav tried this thing both on SQL Server field(of type varchar (700) and also on ntext type) and MS Access field(of Text type).
I m creating my CRecordset class through wizard pointing to database table with ODBC.
CString ppp;
ppp="somevalue"
tstRs->m_res = ppp;
now if ppp is less than 255 it works fine but if its more than 255 characters I get exception .
does anybody know whats wrong ? and how to send a string more than 255 using CRecordset ????
Thanks in advance.
ZINC
|
|
|
|
|
zinc_z wrote: I am having problem sending CString data more than 255 character length to my Database Table through CRecordset class.
I hav tried this thing both on SQL Server field(of type varchar (700) and also on ntext type) and MS Access field(of Text type).
Access tells you right in its design view that a text field can be no larger than 255 characters. See the online specifications here. It's also listed in your ACMAIN11.CHM (or ACMAIN10.CHM) file.
zinc_z wrote: ...I get exception .
What's the exception?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
it gives debug essertion failed at frxdb libraray.
|
|
|
|
|
An MS Access field of type Text is limited to 255 characters. If you want to store more than 255 characters, use a Memo field type.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
I am having the same problem in SQL Server table , where I m using Varchar 700 .
I have tried different fields too , I think its may be the limitation of DoFieldExchange function that It can't send more than 255 characters to DB table ???
Any suggestion ?
|
|
|
|
|
I have an edit box used for user input in my app.
I am able to set the max chars for some of them but others, even though i set it and it shows up in the AFX_DATA_MAP as
DDV_MaxChars(pDX, m_strLastName, 20);
It still allows user to input more than 20 chars without stopping them.
Any ideas anyone?
|
|
|
|
|
why not you use,m_Edit.SetLimitText(20) ?
VuNic
|
|
|
|
|
Where would be the appropriate place to put the setlimittext(20)
In the constructor?
|
|
|
|
|
|
LCI wrote: DDV_MaxChars(pDX, m_strLastName, 20);
This does not "kick in" until the OK button is clicked (which ultimately calls UpdateData() ).
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Once again we are back to the question of how to best terminate a thread. A "regular" thread is easy. A simple boolean variable set to false could terminate a while loop and allow the thread to exit. What happens when a thread is blocked, though? For example, if we had a TCP/IP server and called
m_pSocket->Accept(m_conSocket);
That call will block the thread until a connection is made. What is the best way then to terminate the thread without having to terminate the main thread?
Thanks.
|
|
|
|
|
Well you could use TerminateThread() but that's not recommended. For the TCP/IP server example another solution would be to use a function like select(), with a small time out, to check for incomming connections on the socket and only the call accept() or read() or any other blocking calls. This way the thread will never be blocked for a long time. You could then use a boolean variable to stop it and perform clean up.
|
|
|
|
|
Your asking for trouble even thinking of calling TerminateThread. Here's an example program which shows the kind of thing that can go wrong:
------------------------------------------
#include <windows.h>
CRITICAL_SECTION g_cs;
void ShowMessageBox()
{
EnterCriticalSection(&g_cs);
MessageBox(NULL, "Hello", "ShowMessageBox", MB_OK);
LeaveCriticalSection(&g_cs);
}
DWORD WINAPI ThreadProc(LPVOID lpParameter)
{
ShowMessageBox();
return 0;
}
int main(int argc, char* argv[])
{
InitializeCriticalSection(&g_cs);
// Start thread.
DWORD ThreadID;
HANDLE hThread = CreateThread(NULL, 0, &ThreadProc, 0, 0, &ThreadID);
// Wait for one second then kill the thread.
// It still holds the CRITICAL_SECTION!!!
Sleep(1000);
TerminateThread(hThread, 0);
// We've killed the "ShowMessageBox" API, permanently, calling it now
// causes this thread to dead lock!
ShowMessageBox();
DeleteCriticalSection(&g_cs);
return 0;
}
------------------------------------------
In this program calling TerminateThread permanently breaks ShowMessageBox because we killed the thread when it still held a lock. This is the worst kind of bug as it's very hard to reproduce as it's sensitive to timing. If you're calling Win32 functions many of them will briefly hold locks, if you terminate a thread while it is hold such a lock you're screwed.
Moral: Don't call TerminateThread. There are exceptions but very few.
Steve
|
|
|
|
|
masnu wrote: A simple boolean variable set to false could terminate a while loop and allow the thread to exit.
Be sure you have not instructed the compiler to ignore testing the boolean with each iteration of the loop. Use of volatile will help here.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|