|
string::replace doesn't do what you want, it's for replacing one range of characters, not a search/replace through the whole string. Use std::replace instead:
std::replace ( bufferstring.begin(), bufferstring.end(), ' ', '$' );
|
|
|
|
|
Hi
Can anyone of you please tell me how to read and write to a USB port.
I have an idea that USB device can be used just like file, but I dont know how to do this?
can u send me peace of code
Best Regards
Deepu
|
|
|
|
|
|
Hi,
I have taken a formview and I placed 3 buttons on it.I need to set a different icon for each of these buttons.In the properties dialog box of the button, I found "icon" checkbox but where should I set which icon I need to have on that button.Hope I am clear.
Thanks in advance.
Taruni
|
|
|
|
|
You can load your icon with LoadIcon and use of CButton::SetIcon for set it.
|
|
|
|
|
Hi Experts
My applicatiom having a WCHAR pointer within a structure.
Whenever i delete WCHAR pointer it display exception
"_ASSERTA(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));. "
|
|
|
|
|
You have either written past the end of the array, or you have changed the pointer somewhere in your code.
|
|
|
|
|
Some possible causes:
- You're delete ing a pointer which was not new ed.
- You've called delete more than once on the block.
- You're calling delete on in the middle of a block instead of at the start.
- The heap is corrupt.
Steve
|
|
|
|
|
Hi
all
I want to set menu font in my application to Japanese, i want to do this through coding in VC++ so which API and functions are used to do it.
Thanks
Atul M
Atool
|
|
|
|
|
There are many ways to do this.
1. In the resource file, set the font of the dialog to your Japanese font.
2. Override OnSetFont()
3. Use CreateFont() and SendMessage() passing the font and WM_SETFONT
|
|
|
|
|
Hi all,
I m trying to do multi threading .Actually what i want is to run multiple instances of one thread at same time. I m new to multi threading but i have done single threaded applications ...
Can anybody tell me how to do it ???
thanks in advance
Sulabh srivastava
|
|
|
|
|
Try looking at this article[^]. It's a good introduction to using threads.
Software Zen: delete this;
|
|
|
|
|
Hi guys,
I've got some code from a classmate that was developed in gcc, and which I need to compile in VC++. I know that my problem is a result of VC++ wanting me to give a constant size for an array, but frankly I don't want to (it's not in the assignment specs). Don't worry, this isn't an integral part of the assignment, just setting it up. Here's the code that's causing the trouble:
<br />
int fixAtoi(char myAry[], int arySize){<br />
char myAry2[arySize+1];<br />
for (int i=0; i<arySize+1; i++){<br />
myAry2[i]=myAry[i];<br />
}<br />
myAry2[arySize]= '\0';<br />
return atoi(myAry2);<br />
}<br />
it's that second line there...
Like I said, I know what the problem is, but apart from pre-defining the array size, I don't know of a fix.
P.S. I hope you guys can appreciate having to read all that since I wrote it all while learning the dvorak layout (my second attempt).
Thanks guys,
Sean
|
|
|
|
|
int fixAtoi(char myAry[], int arySize)<br />
{<br />
char myAry2 = new char[arySize+1];<br />
<br />
for (int i=0; i<arySize+1; i++)<br />
myAry2[i]=myAry[i];<br />
myAry2[arySize]= '\0';<br />
<br />
int iRet = atoi(myAry2);<br />
<br />
delete [] myAry2;<br />
return iRet;<br />
}
|
|
|
|
|
You may need to change this like,
int fixAtoi(char myAry[], int arySize)
{
char *myAry2 = new char[arySize+1];
for (int i=0; i < arySize ;i++)
{
myAry2[i]=myAry[i];
}
myAry2[arySize]= '\0';
int nRet = atoi(myAry2);
delete [] myAry2;
myAry2 = NULL;
return nRet;
|
|
|
|
|
Using a variable for the size is a non-standard extension. Use new instead to allocate the array.
|
|
|
|
|
excellent, thank you very much guys. It works perfectly now!
|
|
|
|
|
Sean Wcisel wrote: I've got some code from a classmate...
Shame on your classmate for giving you bad code.
int fixAtoi(char myAry[], int arySize)
{
char myAry2[arySize + 1];
for (int i = 0; i < arySize + 1; i++)
{
myAry2[i] = myAry[i];
}
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Using Connect API we connecting to the smtp or pop server. Some time while connecting to the server more time to take for the response. It should possible to cancel the connnection. Any one help me.
Thanks in advance!
Have A Nice Day!
Murali.M
|
|
|
|
|
Are you referring to the sockets "connect()" API? If so, then you might try using a non-bocking
socket. If you choose to cancel then just close and destroy the socket. If the connection
succeeds then you can be notified via a Windows message or an event depending on your needs, using
WSAAsyncSelect() or WSAEventSelect().
Mark
Great job, team. Head back to base for debriefing and cocktails.
|
|
|
|
|
Could anyone tell me how to get the playtime for a mp3 music? I have
no idea of the structure of the mp3 file, I guess maybe there is a
field in the mp3 file structure which value is the playtime.
|
|
|
|
|
chocm wrote: I have
no idea of the structure of the mp3 file...
Have you tried here?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is probably a dumb question, but how do you use the _MSC_VER macro?
I have created a set of macros, some of which will not work on older compilers, so I obviously need to check for this.
I'm currently making use of the __VA_ARGS__ and __FUNCTION__ macros, so if anybody could also tell me what the minimum VS version required for using these?
-- modified at 21:50 Friday 16th February, 2007
|
|
|
|
|
__VA_ARGS requires VC8 - _MSC_VER 1400
__FUNCTION__ requires VC7 - MSC_VER 1300
#if _MSC_VER >= 1300
#endif
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thankyou
|
|
|
|