|
soory i just got it thatnks a lot!!!!!!!!
|
|
|
|
|
The input string was :- abc{ghj{popeye}jjj
The output string is :- popeye
That's what you wanted huh?
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
thanks i just got it!
|
|
|
|
|
i have just got an error wit the line: y=strchr(t,'}'); on running it i changed the code a bit to:
char abc[1000];
char *Input;
strcpy(abc,Input);
char *t,*y;
t=strrchr(abc,'{');
y=strchr(t,'}');
if(y) *y=0;
cout << t+1;
HidPass = t;
does this have anything to do with it?
|
|
|
|
|
You need to do one more pointer validity check.
char abc[1000];
char *Input;
strcpy(abc,Input);
char *t,*y;
t=strrchr(abc,'{');
if (t) y=strchr(t,'}');
if(y) *y=0;
if(t) cout << t+1;
HidPass = t+1;
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
sorry about all this but now it has a problem with HidPass = t+1;//remember the plus one here
|
|
|
|
|
Is HidPass declared as a char* and if so, has it been allocated some memory using new or malloc?
By the way if the answer is "yes" to the above question replace that line with :-
if(t) HidPass=t+1;
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
i dont get any errors now it just does not work? HidPass does not equal anything?
|
|
|
|
|
hang on i know why thanks for your help
|
|
|
|
|
Steven Richardson wrote:
hang on
Okay
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
you said char *Input; //better alloc some memory here how do i do that?
and i know why it is not working! cos as soon as Input becomes a char it screws up and does not equal what it should?
|
|
|
|
|
Steven Richardson wrote:
you said char *Input; //better alloc some memory here how do i do that?
char *Input = new char[1024];
or
char Input[1024];
Nish
CPUA # 0x0666
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Input cannot be made in to a char as it no longer equals what it should so as a AnsiString it equals: save that{ste} and as a char it equals:ÈóI
|
|
|
|
|
Hi,
I would like to pass a metafile from the container to my ActiveX control ( developed using ATL), how can I do that ? ( I always passed bools or number ... ).
Thanks, Bye !
Braulio
|
|
|
|
|
You can encapsulate your metafile in an object supporting the interface IDataObject . ATL <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_atl_idataobjectimpl.asp">IDataObjectImpl</a> class serves this purpose.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Gracias Joaquin !
I will give a try to that. btw. I continue with my ole and Ms Word do you want to read something funny ? ( check this out from MSDN.... Q241936 ), I thought I was going bananas yesterday
Bye !
Braulio
|
|
|
|
|
Hola Joaquin !
Do you know where I can find some examples about that issue ? ( IDataObjectImpl). I found samples about getting things from the clipboard, but what I would like to do is from the client app, pass an Metafile to the my ATL/server.
Thanks !, Hasta luego !
Braulio
|
|
|
|
|
I am using VC (MFC also) to develop programs under Visual Studio as IDE. Could anybody here exlain how to used Visual studio to detect memory leak?
|
|
|
|
|
In debug mode, you can use <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt__crtmemdifference.asp">_CrtMemDifference</a> and related functions (in <crtdbg.h> ) to check for memory leaks caused by C run-time library allocations (malloc , realloc and new ).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
GOOD LUCK!
C Runtime library for addressing memory, look up _CRT in the MSDN index. Unfortunately, they don't account for all the memory. Beyond that, BoundsChecker by Numega is probably the most popular tool for this purpose.
Hope this helps
Bill
|
|
|
|
|
Bill Wilson wrote:
Beyond that, BoundsChecker by Numega is probably the most popular tool for this purpose.
Freeware???
Nish
CPUA # 0x0666
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
Freeware???
I wish... something like $300 per license.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
Here is an article I found from MSDN. Hope it helps.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_detecting_a_memory_leak.asp;)
|
|
|
|
|
Check the CMemoryState class which can be used for debug versions only.
Atul
Sonork 100.13714 netdiva
|
|
|
|
|
first make this declaration at the top of your stdafx.h file:
#define _CRTDBG_MAP_ALLOC
next make sure that these files are included in your project:
#include <stdlib.h>
#include <crtdbg.h>
finally, when your program shutsdown, you need to call this function:
_CrtDumpMemoryLeaks();
This will produce an output like this:
<br />
Detected memory leaks!<br />
Dumping objects -><br />
C:\PROGRAM FILES\VISUAL STUDIO\MyProjects\leaktest\leaktest.cpp(20) : {18} normal block at 0x00780E80, 64 bytes long.<br />
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD <br />
Object dump complete.<br />
You can click on filename with the line number and it will take you to the place where you allocated the memory. This will be a good place to start.
After you get a list of objects that are leaking, you will now have the allocation number of the block that was leaked. In the example above (18) was the block.
You can run the program again and set a break point when block 18 is allocated. First set a break point right when your program loads.
Declare a variable in your watch window called:
_crtBreakAlloc
Set this variable to 18, this will tell the debugger to break when the 18 block is allocated. With this you can step through the code and know exactly which element that you allocated that is leaking. With this technique it is very important that you perform the exact same operations in the program in order to make the memory allocation follow the same path.
Look up this article on MSDN for more information about this technique:
Detecting and Isolating Memory Leaks Using Microsoft Visual C++ by Edward Wright
This technique is a good, free, place to start, but like other people have said, BoundsChecker is a good place to go if you have the money to buy this tool.
|
|
|
|