|
Can you give me this example link..
|
|
|
|
|
here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Good Afternoon!
I have a string
str = "FFCA0D0000"
I want to convert it into array of bytes
byArray = {0xFF, 0xCA, 0x0D, 0x00, 0x00}
plz supply with some sample code
thankyou!
|
|
|
|
|
What about reading OP's replies?
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
[My articles]
|
|
|
|
|
yes i have reposted same question because i hav got couple of replies from your team
1. from u, written in 'C' i need it in VC++, although it is similiar,
what shall i use in place of sscanf(..) in VC++?
2. i got another sample code but i couldn't understand the code itself,
it was using std::vector..
so please if possible answer my question in VC++ in most simplest way, i have to use it in VS 2005.
hope you understood my problem.
thanks
|
|
|
|
|
sscanf is a run-time library function, you may call it from a C++ application as well as from a C one.
I think you really need some C++ introductory reading.
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
[My articles]
|
|
|
|
|
see wsprintf is of any use!
"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/xml>
|
|
|
|
|
CPallini wrote: What about reading OP's replies?
OMG.. read my reply
"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/xml>
|
|
|
|
|
iterate and cut the string after every blocks of 2 characters.
then convert each 2-chars string into hexadecimal (atoi() does this IIRC)
BTW, it seems that you reposted your question, even when already answered... your luck is that I didn't noticed that myself ! shame on you.
modified on Monday, August 25, 2008 3:40 AM
|
|
|
|
|
I tried in that manner
for ex.
in the first iteraion the splitted string was "FF"
when i used
char ch[2] ={'F','F'} ;
int i = atoi (ch)
actually the whole string was splitted up, each time 2 charaters are picked up and being stored in an character array then i use atoi()
then the result was in this manner
the value of i was assigned to 0 => i=0;
|
|
|
|
|
for atoi() to be able to work, it needs a regular C-style string, that means a nul-terminated pointer.
here, you need to change your ch[] into ch[3] where you need to assign the 3rd character to '\0' always.
|
|
|
|
|
It's not matter of nul-terminating.
Please, try again.
Hint:
int i = atoi("FF");
printf("%d\n", i);
outputs 0 .
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
[My articles]
|
|
|
|
|
yeah, I got your previous reply already... no need to flood either
so, what is that function that gets an hexadecimal string in input, and converts into int ?
|
|
|
|
|
strtol supports different numeric bases.
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
[My articles]
|
|
|
|
|
that's it
I was just too lazy to track that back... ^^
|
|
|
|
|
probably strtol() should help..
Regards,
Sandip.
|
|
|
|
|
toxcct wrote: IIRC
No luck. Try again.
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
[My articles]
|
|
|
|
|
Hi All,
Anyone can tell me how to take Snapshot of a volume programatically?
|
|
|
|
|
Could anybody is able to reply? Any link ....Anything you know.....
I am waiting......
|
|
|
|
|
People will answer your question in their own time. If they know something then they'll reply to your question; if they don't then they won't. Please have a bit of patience.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
Perspx wrote: If they know something then they'll reply to your question
if they understand the question as well...
|
|
|
|
|
Yes
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
The below mentioned code Working fine in the first run, but crashes in the second run
---------------------------
nav.exe - Application Error
---------------------------
The instruction at "0x000003f8" referenced memory at "0x000003f8". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
.h
typedef struct THREADSTRUCT_SCOPE
{
long maxRowCount;
AttMap selection;
MsgList *results;
AOL *assets;
THREADSTRUCT_SCOPE( const Scope* ptr )
: _this( ptr )
{} const Scope *_this;
} THREADSTRUCT_SCOPE;
THREADSTRUCT_SCOPE *_param;
.cpp
<pre>
SysScope::SysScope
(
)
{
_param= new THREADSTRUCT_SCOPE( this );
}
SysScope::~SysScope()
{
delete _param;
}
bool Scope::genericSearchByAtt
(
const long maxRowCount, // I: Maximum number of rows to return
const AttMap& selection, // I: Selection attributes
MessageList& results, // U: Result
AOL& assets, // O:
int ObjectType //
)
const
{
invalidArgAssert(maxRowCount > 0 &&
selection.contains(Id::Attr_ClassType));
.....
...
....
assets.push_back(asset);// CRASHES HERE only druring Second run
}
bool Scope::searchByAttributes
(
const long maxRowCount, // I: Maximum number of rows to return
const AttMap& selection, // I: Selection attributes
MsgList& results, // U: Result messages are appended
AOList& assets // O: Asset objects
)
const
{
HANDLE hThread;
_param->assets = &assets;
_param->maxRowCount = maxRowCount;
_param->results = &results;
_param->selection = &selection;
hThread=(HANDLE)_beginthreadex(0,0,WorkerThread,(void*) _param,0,0);
while (1) //iThDone!=1
{
if (iThDone==1)
break;
DoEvents9();
}
return true;
}
unsigned __stdcall Scope::WorkerThread(void* param)
{
THREADSTRUCT_SCOPE* ts = (THREADSTRUCT_SCOPE*)param;
BASE_ASSERT(ts->_this->genericSearchByAtt(ts->maxRowCount,
*ts->selection, *ts->results, *ts->assets, Asset::Type) );
iThDone=1;
return 1;
}
modified on Monday, August 25, 2008 3:07 AM
|
|
|
|
|
you may be using a out of bounds value or some uninitialized variable/pointer in the second run.
Did you try and debug the application to check what values reside in the variable during second run?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Any clue from the above code, Since I am using thread, The fuction which is called from thread for second time is failing, Is that the thread is still active when calling for second time or some thing like that
so can you pls advice
|
|
|
|