|
Thanks!! you solved me the problem.
i clicked properties and the "charset" was unicode, so i changed to multy-byte charcters (its ok?) but now its compiling me with no error, now i can go back to learn, thanks.
Gindi Bar Yahav - Web & Software defeloper.
|
|
|
|
|
|
|
|
|
|
jeron1 suggested a very good article, indeed.
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]
|
|
|
|
|
I didn't I rated his post, however that is not my problem
(if you read my question) my issue is I need something such as BitConverter (in c#) in c/c++
|
|
|
|
|
Your question looks actually arising from a endianess problem; I doubt that a BitConverter -like class would be of any help.
Probably if you elaborate it a bit then we might properly appreciate your issue.
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]
|
|
|
|
|
CPallini wrote: Your question looks actually arising from a endianess problem; I doubt that a BitConverter-like class would be of any help.
Probably if you elaborate it a bit then we might properly appreciate your issue.
? like the question suggests I have converted it from big endian to little, but as stated I cannot just read straight into a double now, i must first grab the data into a char[], convert from big to small, then what I am left with is a char[] filled with binary data.. i need to convert from binary data into a double,int,or float... I could write my own function that would use the mantissa and all that for the float, but I don't think it should be that much trouble and there has to be an easier way of doing it
|
|
|
|
|
Greg Mort wrote: ...what I am left with is a char[] filled with binary data.. i need to convert from binary data into a double,int,or float...
Would a union work?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have seen a few implementations of unions with similar threads, I however seem not to be able to get it to work, then again I have never used unions before
|
|
|
|
|
Never heard about union s?
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]
|
|
|
|
|
|
Greg Mort wrote: you cant read can you?
Yes, I'm able to (as a proof I can see a typo in your sentence... ).
Good luck with your reversed char[] and float .
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]
|
|
|
|
|
This is C++, you don't even need a union , you could just type-pun it directly, from a char[] to a double* or float* or whatever you want. The union isn't any better with Unidefined Behaviour here, only one member of the union is required to have a value at any one time - so it's just as bad as pointer-wise type-punning. Both methods should work anyway.
|
|
|
|
|
Thank you, I just figured this out as well
|
|
|
|
|
|
Looks like an endianess issue.
|
|
|
|
|
I agree, so how to I grab it from a file, reorder the data, and place the value in a double variable?
|
|
|
|
|
Maybe this[^] article will help.
|
|
|
|
|
Please look at the following lines of code.
<br />
PULONG count;<br />
PLUID* sessions;<br />
<br />
LsaEnumerateLogonSessions(count, sessions);<br />
I got the following error on that..
<br />
error C3861: 'LsaEnumerateLogonSessions': identifier not found, even with argument-dependent lookup<br />
Any idea why it's happen there in the code?
Thanks a lot
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Are you sure you're including the correct headers?
|
|
|
|
|
CodingLover wrote: Any idea why it's happen there in the code?
Are you including Ntsecapi.h ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
In my code I'm trying to call SendARP to get the MAC address of a computer on the local network. I have their IP address in the in_addr data format, but SendARP takes it as an IPAddr.
I looked on MSDN and they don't offer any explicit ways to convert between the two and google searches so far have not proven fruitful.
Anyone done this before?
|
|
|
|