|
"the debugger shows some garbage at the end, since the string is not 0 terminated"
as Pallini told, this what is happening in your case. you better increase your buffer length to 17 and check again, then the debugger shows the string properly.
|
|
|
|
|
The problem is not what the debugger diplay, but the content displayed.
i know my data is not null-terminated, but each character should be the same as the original string.
modified 14-Jun-22 21:01pm.
|
|
|
|
|
Ahryman40k wrote: i know my data is not null-terminated...
Then you know why it appears wrong. The terminating nul character has been overwritten.
"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
|
|
|
|
|
This code works well on another project too.
i'm looking for a preprocessor or an option who should modify my string but i have no idea.
modified 14-Jun-22 21:01pm.
|
|
|
|
|
That code must work. Are you sure there aren't aother statements between assignment and check?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
This is my problem.
It MUST work but it doesn't work ! :s
no override on new operator.
just this simple code:
char* pByte = new char[16];
memset( pByte, 0, 16 );
memcpy( pByte,"çj]%Þ6f$.JÛ.$(ñå",17);
who do not its job !
Is there any VC++ options who can change this ?? ( this is not a UNICODE problem and i really have no idea where the problem comes from )
modified 14-Jun-22 21:01pm.
|
|
|
|
|
Ahryman40k wrote: But if i check in memory what my pointer contains, i see the following value :
+ pByte 0x04b78f98 "çj]%Ãz6f$.JÃ>.$ýýýý««««««««îþîþ" char *
How are you verifying this?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
With the VC++ 2003 debugger. In step by step debug mode.
Just after memcpy, i'm looking the content of my pointer. but datas allocated are different from original datas.
I'm looking for an option or a preprocessor whitch could modify datas ...
This problem appears in a project that i don't maintain.
In this project when copying "ç" character in a char pointer, the result become "ç".
I have all code sources.
the whole project is well compilated.
I don't know what it happens in this project ...
modified 14-Jun-22 21:01pm.
|
|
|
|
|
First check memory is allocated or not. Then check ASCII value stored in pByte memory location in memory debug window.
|
|
|
|
|
Memory is well allocated,
the value stored in memory location is provided in the first post.
modified 14-Jun-22 21:01pm.
|
|
|
|
|
Your source code file has been saved as UTF-8, but the compiler is reading it as Windows-1252 or whatever your local code page is.
Don't use characters outside of ASCII in source code, use the \x escape instead (or \u if your compiler supports it).
|
|
|
|
|
Michael Dunn wrote: Your source code file has been saved as UTF-8, but the compiler is reading it as Windows-1252 or whatever your local code page is.
Don't use characters outside of ASCII in source code, use the \x escape instead (or \u if your compiler supports it).
You're right, my source file was save as UTF-8, that's why what i see was different than what my string appenned.
Thank you.
modified 14-Jun-22 21:01pm.
|
|
|
|
|
Hi everyone,
good afternoon to all.i am writing one OCX file.in that file i am doing read and write functions. and in another project i am using that OCX.When i am passing parameters to that function then that time values taking as null.in runtime when i given some values to that parameters that time also they are takingas null only.in VC++ how can i pass the parameters by refence please. In OCX file write function is
READBLK(LPCTSTR MemId, LPCTSTR MemName, LPCTSTR eDate, LPCTSTR Balance, LPCTSTR TagId);
and in my main project write block is like this:
OCX.READBLK(MemId,Memname,Date,Balance,Tagig)
{m_MemId=MemId;}like this i am assigning the value.
these MemId,Memname,Date,Balance and Tagid are of type CString
after writing the data in the card.after writing i want read that data from the card but the data is not printing on the form or not returning to my project from OCX file.
please reply me.
please Help me.
thanku,
savitri
|
|
|
|
|
What?
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: What?
Anyone figuring it out will get a candy.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
What do you need to know about? What is your difficulty?
Please be more specific.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I have a MFC dialog based applicaton in which i am hosting a web browser.
I want to capture any mouse click event in the HTML file contained inside this web browser in my application.
Can anyone please help?
Thanks,
Sujeet
|
|
|
|
|
It can be done but the only way I know of is quite hard. First you need to make sure there is a script, Javascript or VBscript, in or linked to whatever page is in the browser, that must have an onclick handler for the <body> tag. This gets the click from the mouse into script. Now you need to poke around in the Document Object Model of the WebBrowser control to determine how to access the Window object, or equivalent. This will have a mechanism for raising an event to it's parent. I'm afraid I've forgotten exactly how this works but it will end up with an ActiveX event being raised to your dialog. This means of course your dialog needs to be a fully fledged ActiveX control container with the relevent event handler. That in itself is pretty complex but ATL/WTL can do most of it for you. Considering the amount of work this all is, unless you've got most of it in place already you might want to find another way, perhaps do all the click handling in script within the browser.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I have a MFC dialog based applicaton in which i am hosting a web browser.
I want to capture any mouse click event in the HTML file contained inside this web browser in my application.
Can anyone please help?
Thanks,
Sujeet
|
|
|
|
|
Any body knows how to detect all the controls in a window including button controls, input controls and other menus in any windows. I am trying to develop a GUI Automation tool.
Thanks
|
|
|
|
|
Hints:
1. (usually) controls are windows.
2. Windows API provides EnumChildWindows [^] function.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hello,
I would like load the resource (string,bitmap,...) from one exe that create a activeX control.
That mean I have a activeX control that will show a bitmap or string from the exe. It is possible ?
I now that is possible from dll to get resource from exe.
Thank you for help
AutreChien
|
|
|
|
|
NorGUI wrote: I now that is possible from dll to get resource from exe.
yes. Why you did't tried.
|
|
|
|
|
Hello,
I have just see somewere that was possible but I can not found were I can do that. Can you help me or give me a link to see how to do that.
Thank you for your help.
AutreChien
|
|
|
|