|
thx..
I have some thing like that.
unsigned char DATA[25]; // DATA array consist of hex values.
I want to convert DATA[1] and DATA[2] contain hexadecimal values that is (0x00 0x02) into the decimal value.plz let me knw accordindly..thanks in advance.
|
|
|
|
|
__int16 i = *(__int16 *)pYour2Bytes;
FYI: unsigned chars do not contain "hexadecimal values" . a uchar contains 8 bits which can be combined to represent numeric values from 0 to 255 in decimal, or 0 to 0xff hex, or 0377 in octal, or 00000000 to 11111111 in binary, or any other base you prefer to use.
|
|
|
|
|
Please explain what you want to achieve. It appears you want to read two Text Strings, base 16, and combine them into one int.Why only shift 8 bits,etc. A lot depends on your End Pointer &p, which appears to be not modified between calls. How are you sure that p points to a valid end value in BOTH Strings. Me thinks that your code cannot make sense!
See your Standard header File for
'long strtol( const char *nptr, char **endptr, int base );'
LateNightsInNewry
|
|
|
|
|
(methinks your reply was misplaced)
|
|
|
|
|
sorry i was away-
unsigned char DATA[25];
Array contain different hexavalues(One function fills the values in DATA array). Now I want to read DATA[1] and DATA[2] values combinely.
let suppose,
DATA[1]=0x0b
DATA[2]=0x0b
The Decimal values for 16 bit(2 bytes DATA[1]& DATA[2]) is 187..
plz explain me how can i do that.thx
|
|
|
|
|
sorry..
DATA[1]=0x0b
DATA[2]=0xb0
The decimal value is 187.
|
|
|
|
|
__int16 i = *(__int16 *)&DATA(1);
|
|
|
|
|
thx for the help done.
|
|
|
|
|
if you have the string-representation of the hex number, such as "F5", the you may use strtol function, e.g.
char *pEnd;
long nVal = strtol("F5", &pEnd, 16);
hope that helps.
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.
|
|
|
|
|
I have following situation:
class A {...}
class B : public A {...}
can i do this:
A *a = new B;
delete a;
Thank you for reading and even more for answering
|
|
|
|
|
I cannot see any question marks, but since the written code isn't obviously wrong or bad the conclusion is this:
The written code is maybe ok.
Problems might occur if the base class destructor isn't declared virtual ; if so, the derived class destructor will never be called and memory might leak.
|
|
|
|
|
Yes of course. Why not ?
If you want the destructor of B to be called, you need to make the destructor of A virtual (take this habbit: whenever you have a class that can be inherited, declare its destructor virtual)
|
|
|
|
|
Thank you for answering. It was more annoying stuff, but i didnt noticed it:
class A {...}
class B : public A, public X {...}
class C {...}
my code:
X *x = new C;
delete x; // kabooom
Well problem solved, thank you again for answering.
|
|
|
|
|
Hello everybody,
i want to avoid the menu which pops up with a right click on the taskbar button of an application but I find no way to trap this event. Does anybody have a solution for this problem?
MS
|
|
|
|
|
|
Hello cpallini,
thanks a lot, that seems to work. The disabled close button does not affect my purpose.
MS
|
|
|
|
|
|
even you got the answer, i just wondere : why on earth do you want to remove this standard windows behaviour ?
|
|
|
|
|
|
Hi All,
I am debugging an application(MyApp) which uses an OCX control.
I need to debug the OCX control too.
I am able to compile the OCX in debug mode and have copied the MyOcx.ocx and MyOcx.pdb files to MyApp Debug folder.
When I try to debug the MyApp I am not able to debug the OCX code. I checked with the modules window and found that the symbols for the ocx could not be loaded and it shows "" C:\WINDOWS\System.Drawing.pdb: Cannot find or open the PDB file." error
I checked with the C: files but the .pdb do not exist.
Is it a problem with my m/c that it does not have the System.Drawing.pdb file or I am wrong somewhere else?
Please help me.
Just a note to add: MyApp is built in VS2005 and MyOcx is built in VS2003.
Any help would be highly appreciated.
Thanks and Regards,
Arti Gujare
-- modified at 7:04 Tuesday 28th November, 2006
|
|
|
|
|
Hi Arti,
do you perhaps use the .NET Framework in your OCX? Because "System.Drawing" sounds like the corresponding namespace of the .NET Framework.
Perhaps your callstack looks nicer if you use the Microsoft Symbol Server to get the corresponding debug symbols. Then for example "System.Drawing.pdb" will be automatically downloaded from M$.
Checkout the following articles on how to configure Visual Studio to connect to the M$ Symbol Server:
http://www.codeproject.com/useritems/symbols.asp[^]
http://www.codeproject.com/debug/postmortemdebug_standalone1.asp[^]
cheers,
mykel
If they give you lined paper, write the other way!
|
|
|
|
|
hello !
my datasource name : "Database_MyWorld";
whow to retrieve if my DataSource exist or not in to :
if(.......)
{
AfxMessageBox("YES");
}
else
{
AfxMessageBox("NO");
}
Bravoone
|
|
|
|
|
to test if the connection to your database is correct or not, you can try this SQL statement :
SELECT 1 FROM DUAL;
|
|
|
|
|
but how can i retrieve if is correct or not ?
can you give me more please ...because i need an answer into AfxMessageBox("...");
Bravoone
|
|
|
|
|
how do you connect ? ADO ? ADO.NET ? ODBC ?...
|
|
|
|