|
Or you could be really brave and use the replace() function.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
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.
|
|
|
|
|
The replace method requires you to specify the character positions that you want to replace.
This means you must still iterate over the string. No?
|
|
|
|
|
Independent123 wrote: The replace method requires you to specify the character positions that you want to replace.
That's one option.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Well I've looked at all the overloads and that appears to be the only option.
|
|
|
|
|
Independent123 wrote: Well I've looked at all the overloads and that appears to be the only option.
Direct memory access would always faster. but there you have to check for upperbound of string array
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
void main( void )
{
string name = "this is the string to replace";
cout << ']' << name.c_str() << '[' << endl;
replace(name.begin(), name.end(), 'r', 'R');
cout << ']' << name.c_str() << '[' << endl;
}
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi there,im looking for some information on how i can perform mathmatical task using timers.
here is the pusudo code of what i would like to do.
string Result;
Result = Time + 2 hours
or
Result = Time + 10 Minutes
Any ideas guy's?
|
|
|
|
|
What does this have to do with timers?
Did you mean time? If so, you could use the CTime/CTimeSpan or the
COleDateTime/COleDateTimeSpan classes.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thes3cr3t1 wrote: Result = Time + 2 hours
What unit of measurement is "time" in? If it's in seconds, add 7200. If it's in minutes, add 120.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a main C++ Routine with an include file called MyMainFile.h. Have a number of global variables in the include file that I want to be visible to a subroutine that is called from the main C++ program. However, when I call the subroutine, and include the MyMainFile.h in the subroutine, none of the variable that are declared in the include file, MyMainFile.h, are available. The compiler designates them as undeclared variables?? Any ideas? Sid Kraft
Sid
|
|
|
|
|
In the include file use the extern keyword before usual variable declaration, for instance.
extern int myGlobalInteger;
BTW: use sparingly global variables.
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.
|
|
|
|
|
guys just a quick one,how can i access or export the data stored in a varible within my dll, i want to access the data from my msvc++ aplication.
cheers Chris
|
|
|
|
|
|
In the DLL declare the variable something like
<a name="more">__declspec</a><a name="more">(dllexport) int DLLInt;</a>
In the EXE, something like
<a name="more">__declspec</a><a name="more">(dllimport) int DLLInt;</a>
Since it's easier to declare things in just ONE place, like
a common header file, you can use a macro that imports or exports
the variable depending on what's getting built, the DLL or an EXE...
<a name="more"><font color="Green">
#if defined(BUILDING_DLL)
#define MY_IMP_EXP dllexport
#else
#define MY_IMP_EXP dllimport
#endif
__declspec</a><a name="more">(MY_IMP_EXP) int DLLInt;</a>
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Your solution is probably much more to the point of what he was interested in than mine .
Software Zen: delete this;
|
|
|
|
|
|
Hi there
i'm using GetCursorInfo in order to have the handle to the cursor. How can I know what type of cursor do I have ( ex arrow, hand, wait)???
|
|
|
|
|
duta wrote: How can I know what type of cursor do I have ( ex arrow, hand, wait)???
If it's a custom cursor, then you won't know what it is.
For system predefined cursors, you MAY be able to compare the handle to
the handle returned by LoadCursor() for predefined cursors.
I'm not sure if those handles are always the same but it's easy enough to test
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: ...but it's easy enough to test
Surely you jest!
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No.
And don't call me surely
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
A better question is, why do you want to do that? As Mark stated, it's gonna fall apart if someone sets up a custom cursor anyway, and even if that never happens you'd still be depending a good deal on what is essentially an implementation detail of how Windows loads common images... so unless this is a convenience thing (you need to record the current cursor for some reason and want to display a friendly name for it if possible), you're better off finding another way of maintaining state.
---- ...the wind blows over it and it is gone, and its place remembers it no more...
|
|
|
|
|
The Bottom Line is that good programming practice dictates, that you keep track of what you do! That's called Programming!
Bram van Kampen
|
|
|
|
|
Hello,
I have a CDatabase object.In the ExecuteSQL() method I can execute on query but how can I execute more than one SQL queries using the CDatabase object.Or Is there any other class.
Prithaa
|
|
|
|
|
prithaa wrote: how can I execute more than one SQL queries using the CDatabase object
Call ExecuteSQL more than once (?)
Note that if you want to use SQL commands that return records, you need
to use a CRecordset.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|