|
I have this graph to explain my case :
The Virtual Mem is the Virtual Memory Size of the process.
The Used Mem is the Physical Memory used by the process.
thx
|
|
|
|
|
Well, if you can find those two values in the Performance Monitor, the solution is rather simple.
"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
|
|
|
|
|
In the AppWizard and CodeWizard directories of Microsoft Visual Studio there are some code template files. These templates contain string substitutions such as [!output CLASS_NAME]. Does anyone know where I can find a list of these 'variables' and what they are substituted with? Also does anyone know if it is possible to add ones own 'variables'.
|
|
|
|
|
Hi all,
I have the following string: "MA01234 TEST" and I want to replace the number part of the string with a value of (just an example) "43210 ". So how can I replace the value within the string? What function can I make use of?
Example:
MA01234 TEST
TO
MA43210 TEST
Can anyone please assist me.
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Well, if your string fields have fixed format, then it is pretty easy (just replacing characters, I think you can figure how).
On the other hand, with variable field format you have to parse the strings to extract the numeric field (maybe the other ones) and replace it.
A powerful tool to do such string operations is a regular expression parser, like
Boost.Regex
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.
[my articles]
|
|
|
|
|
CPallini wrote: On the other hand, with variable field format you have to parse the strings to extract the numeric field (maybe the other ones) and replace it.
A powerful tool to do such string operations is a regular expression parser, like
The numbers that I provided was only an example it could have been alphabetic as well.
CPallini wrote: Well, if your string fields have fixed format, then it is pretty easy (just replacing characters, I think you can figure how).
It is fixed and I'm not looking for the complete answer, but just want to know which function I can make use of to replace a part of the string from a starting location to a end location.
Thanks for the reply
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Oh, if it is fixed you don't need functions at all (assuming ASCII strings):
int i;
char record[]="MA01234 TEST";
char new_field[]="43210 ";
for (i=0; i<6; i++)
{
record[2+i]=new_field[i];
}
of course hard-coded numbers are ugly, but I think the concept is clear.
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.
[my articles]
|
|
|
|
|
|
There are I think 2 approaches to this. You can either use a regular expression engine (something I know next to nothing about but there are CP articles if you search) or you can code it yourself. A loop from 0 to the length of the string would be your basic algorithm, pick out the numbers either one digit at a time or as a group and replace them either in place or by generating a new modified string by partially copying the old one. The C Runtime has lots of useful functions like _isdigit and strcat which could help you and stl strings have useful things like functions to reverse strings as well. It important to decide if you're only working in ASCII here or only in UNICODE or if you want it to work for both.
This function seems very specific as well so you might want to break it down into more usefully generic things like bool find_digit_sequence_in_string( TCHAR* aString, int& iBegin, int& iEnd )
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for the reply and the information provided. I will be working with ASCII and the numbers that I provided in my example was just that ... an example it could have been letter as well. Basically I'm looking for a function that will allow me to copy from a starting position to a end position within a string. Does something like this exist? I can think of a way to do it with string copy but it feels like a very long way to perform something like this.
Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
stl strings have a substr function you can use for this
<br />
basic_string substr(<br />
size_type _Off = 0,<br />
size_type _Count = npos<br />
) const;<br />
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for the info Matthew.
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
std::string content can be changed using indices (operator []). Or you can use the replace member function. Either useing iterators or index and count.
Or you assemble a new string (e.g. using a std::stringstream) from parts of the old an new string.
The possibilities are endless!
For the case you presented, I would simply use the
string[i] = 'n' way.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
|
Hello All,
I want to make an application which can run as windows Service.
Anybody help me how can i start?
Thanks in advance
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
manish.patel wrote: I want to make an application which can run as windows Service.
Anybody help me how can i start?
Nishant Sivakumar can.[^]
His article is part of a whole section dedicated to services: read them!
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi Friends,
I am using an SDI Application, i want to show a BITMAP image in the SDI,
How to do that.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
for instance (inside OnDraw method of your View class):
...
CBitmap *pOldBmp, bmp;
bmp.LoadBitmap(IDB_MY_BITMAP);
CRect rc;
GetClientRect(&rc);
CDC dcMem;
dcMem.CreateCompatibleDC(pDC);
pOldBmp = dcMem.SelectObject(&bmp);
pDC->BitBlt(0,0,rc.right,rc.bottom, &dcMem,0,0,SRCCOPY);
dcMem.SelectObject(&pOldBmp);
...
Please note: error handling and efficience tuning left to the reader.
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.
|
|
|
|
|
Or
CImage m_Image;
m_Image.Load(_T("c:\\1.jpg")); or 2.bmp
m_Image.BitBlt(1024,768,dc._hDC);
...
|
|
|
|
|
hi i am using cprogramming
i am trying to write the a link list structure to a binary file using:
fwrite()
anyone know how should i go about doing so?
|
|
|
|
|
can u explain a bit more in detail
|
|
|
|
|
Object serialization is a rather big topic. You can either exploit MFC serialization support http://msdn2.microsoft.com/en-us/library/6bz744w8(VS.80).aspx[^]
or develop your own mechanism (this can be simple provided your structures have fixed sizes).
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.
|
|
|
|
|
Serialization in C ?
|
|
|
|
|
Oh, you can do it. You have structs, after all.
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.
|
|
|
|
|
There's an awesome book called 'Mastering Algorithms with C' published by O'Reilly. It's where I learned all this sort of stuff, highly recommended.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|