|
SaRath C wrote:
when im trying to register a OCX im getting following error
"The specified module could not be found".
The Module used by OCX is not found at the time of registering, mainly it is libaray file!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
thanks for the reply. here net has some problems so I could not see ur answer. it could have save my time
SaRath.
"Don't Do Different things... Do Things Differently..."
|
|
|
|
|
The Issue has resolved. the OCX was using another DLL and was in not in the current path or system32.
SaRath.
"Don't Do Different things... Do Things Differently..."
|
|
|
|
|
This occurs when an ActiveX control is
not registered, or a dependent dll cannot be found.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Hi all,
I need to copy a string which may contain NULL characters in between. I may run a loop but I just wanted to know if there is any other way to do this. Normal function like strcpy and all will stop reading after it encounters a NULL since it assumes end of string when it reads NULL.
NOTE: I am using plain C.
|
|
|
|
|
Aljechin wrote: NOTE: I am using plain C.
strncpy or memcpy should help.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
strncpy will not work:
The strncpy function copies the initial count characters of strSource to strDest and returns strDest. If count is less than or equal to the length of strSource, a null character is not appended automatically to the copied string. If count is greater than the length of strSource, the destination string is padded with null characters up to length count.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Cedric Moonen wrote: strncpy will not work:
Yeah it won't. Was just a blind hit. Was not sure about it. Read the docs now. Sorry for that.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
<br />
char szSource[23] = {"Before\0After"};<br />
char szDest[23];<br />
<br />
ptr = memcpy(szDest,szSource,22);<br />
printf("%s %d",szDest,strlen(szDest));<br />
Hi, may i please request you to just try this code and comment on why memcpy is failing? Is it the way it goes or am I wrong somewhere? Can you suggest some workaround? Thanks for your time.
|
|
|
|
|
Aljechin wrote: Hi, may i please request you to just try this code and comment on why memcpy is failing? Is it the way it goes or am I wrong somewhere? Can you suggest some workaround? Thanks for your time.
Sure! Please look up memcpy in MSDN. There is a working demo there.
See you were saying that szSource contains NULL characters right? So strlen won't work because it will return when it finds the first null character. Same with printf and other functions. They all return when the first NULL character is found. So if your string is...
"Nibu\0is a\0\0\0good\0boy\0". strlen will return 4 . printf will print only Nibu
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Thank you so much. I will surely check that example and get back to you with the problem status.
peace homie
|
|
|
|
|
Aljechin wrote: ptr = memcpy(szDest,szSource,22);
Use 12 instead.
Aljechin wrote: printf("%s %d",szDest,strlen(szDest));
This is highly dependent on szDest being nul-terminated. Using memcpy() implies that you are not treating it as a nul-terminated string.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Thank you so much.
|
|
|
|
|
Aljechin wrote: I need to copy a string which may contain NULL characters in between
How about std::copy[^]?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
char szSource[23] = {"Before\0After"};<br />
char szDest[23];<br />
<br />
ptr = memcpy(szDest,szSource,22);<br />
printf("%s %d",szDest,strlen(szDest));
I went through that page, but not getting it. Can you show me a small code snippet of how do i copy that szSource into szDest? Sorry if a very elementary question.
|
|
|
|
|
What are you trying to do exactly ?
Is not because memcpy sucessfully copied the source into the destination that the '\0' character will be removed. It will still be present in the new string so as soon as you try to get its length or print the string, you will only have the begining of the string. This is totally logical.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
What I am doing? PIP (Peripheral Interface Programming). I have generated a sequence of binary data which will be understood by a peripheral device. For example, we issue a print command from notepad. Its not the .txt file that is sent to the printer by the OS. But a series of printer-understood data is sent. My program generates such device-understandable data which could be just dumped into the port of the device and it will print some meaningful text or act accordingly. I have this binary (kinda junk) stored in unsigned char array. So, I am trying to figure out a way to do this.
|
|
|
|
|
So, what is the problem ? Your data is there but if you try to display it with a function that waits for a string, you won't be able to see past the zero char. Just send your buffer and it will work. You need to remember the size of your string of course because strlen won't work.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
|
Aljechin wrote: char szSource[23] = {"Before\0After"};
char szDest[23];
ptr = memcpy(szDest,szSource,22);
printf("%s %d",szDest,strlen(szDest));
<br />
char szSource[23] = {"Before\0After"};<br />
char szDest[23];<br />
<br />
std::copy(szSource, szSource + 23, szDest);<br />
However, as Cedric already noted, don't expect that printf and strlen show the whole thing if you have embedded zeroes.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Thank you so much. I will try this.
|
|
|
|
|
Hi all
How can I get file size in mega bytes ?
Is there any good API, for this ?
I have a MFC prpject.
thank you.
|
|
|
|
|
big_denny_200 wrote: Hi all
How can I get file size in mega bytes ?
Is there any good API, for this ?
GetFileSizeEx() for reteriving size of File and convert that into MB by divinding it by 1024 *1024
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi ThatsAlok,
How are you?
and StrFormatByteSizeA
whitesky
|
|
|
|
|
WhiteSky wrote: How are you?
Fine
WhiteSky wrote: nd StrFormatByteSizeA
Will try!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|