|
thanks! no problem, I just wanted to make sure I wasn't brushing something under the carpet that would lead to problems later
|
|
|
|
|
Good morning .. .
I know I can use CString::FormatMessage to format strings when localizating my application ( see this[^] )
Is there an equivalent in STL or for standard C++ or is that too OS/Toolkit oriented to have a unified solution ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
all i know of is sprintf.
~Nitron.
ññòòïðïðB A start
|
|
|
|
|
CString/CStringT::FormatMessage(...) wraps the standard FormatMessage(...) function.
This function uses a writable character buffer to format the string into. I do not know of a "proper" way to get writable access to the internal buffer in a basic_string object (data() returns a const pointer to the data).
I would suggest that you allocate a temporary buffer, format into it, and then assign the contents of that buffer to the STL string:
TCHAR caBuffer[ 1024 + 1 ];<br />
<br />
::FormatMessage( ... caBuffer ... );<br />
caBuffer[ 1024 ] = _T( '\0' );<br />
ssYourSTLString = caBuffer;
Peace!
-=- James 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! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
no,no ( but thanks for the info ... )
I was wondering if there was a standard STL/C++ way to deal with such an issue ? if the STL group or C++ standard had such concerns or if it's too closelly tied to the OS/Toolkits.
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: no,no
"no, no" about what?
Anyway, yes; the FormatMessage(...) is not a "standard" function, like how one may consider printf(...) , a standard function - it is a Windows platform function, so not something one would expect to be handled by standard C++ or STL.
Peace!
-=- James 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! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I was writing to myself ... I did not clearly explain what I seeking...
sorry ...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
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
|
|
|
|