|
1) For such an expression:
unsigned char t = 257;
t is truncated. Thus, value of t will be 1 as a result.
2) I would suggest you try ...
unsigned short bbb = A;
_asm
{
MOV DX, PORTB
MOV AX, bbb
OUT DX, AX
}
<b>Maxwell Chen</b>
|
|
|
|
|
sorry it's in the range of 1-256
so if i will write "unsigned char t = (unsigned char) A;"
between 1-255 AL will get the same numbers.
and if i will give A,
the value 256, AL will get the number 0,and i would know it was 256.
I understood you correctly?
|
|
|
|
|
My only comment is unless you are in a device driver the Out Dx,Al will probably throw a hardware exception in NT, 2K, 2K3 or XP.
John
|
|
|
|
|
not only probably... it will!
Don't try it, just do it!
|
|
|
|
|
That's what I thought but I have ran some old dos games (in XP) with soundblaster and they worked. I was surprized of this. Do you know how this works?? Is it because of the VDM?
John
|
|
|
|
|
I create a signed message with CryptSignMessage, but I found this function would read the whole data to be signed into memory, if I want to sign a file which size is 100MB, I must malloc 100MB memory for it.
I need a solution that can sign message as a block by block.
|
|
|
|
|
what is the difference between assignment operator and copy constructor
thanx
|
|
|
|
|
class A
{
public:
A() {}
A(const A& t) { std::cout << "Copy ctor\n"; /* ... */ }
operator = (A& r) { std::cout << "Assignment ctor\n"; /* ... */ }
};
void f()
{
A aa;
A bb = aa; // Copy ctor is used.
A cc;
cc = aa; // Assignment ctor is used.
}
<b>Maxwell Chen</b>
|
|
|
|
|
thanx 4 replying maxwell
r u seen my question these think i know
thanx
|
|
|
|
|
In the book "The C++ Programming Language, 3rd Ed" by Stroustrup,
page 246,
The fundamental reason is that a copy constructor initializes uninitialized memory, whereas the copy assignment operator must correctly deal with a well-constructed object.
Maxwell Chen
|
|
|
|
|
Hi to all,
I made a Visual C++ MDI app with help support
Project name is *****Manager,and I set the builder
to build my app as *****Man.exe
My help file is *****Manager.hlp,but if I click
on the help button in my app It requested me
for *****Man.hlp
Who can I set my app to search for default for
*****Manager.hlp?
Thanks to all
Cristian
|
|
|
|
|
From the MSDN:
CWinApp::m_pszHelpFilePath
Remarks
Contains the path to the application’s Help file. By default, the framework initializes m_pszHelpFilePath to the name of the application with ".HLP" appended. To change the name of the help file, set m_pszHelpFilePath to point to a string that contains the complete name of the desired help file. A convenient place to do this is in the application's InitInstance function. m_pszHelpFilePath is a public variable of type const char*.
Note If you assign a value to m_pszHelpFilePath, it must be dynamically allocated on the heap. The CWinApp destructor calls free( ) with this pointer. You many want to use the _tcsdup( ) run-time library function to do the allocating. Also, free the memory associated with the current pointer before assigning a new value. For example:
//First free the string allocated by MFC at CWinApp startup.
//The string is allocated before InitInstance is called.
free((void*)m_pszHelpFilePath);
//Change the name of the .HLP file.
//The CWinApp destructor will free the memory.
m_pszHelpFilePath=_tcsdup(_T(“d:\\somedir\\myhelp.hlp”));
CWinApp Overview | Class Members | Hierarchy Chart
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Thanks very much
I first tried to search the solution in MSDN library but I didn't found anything,probably I was searching in the wrong direction
And like we say in Italy...
CIAO CIAO
|
|
|
|
|
Thats OK. Half the problem with the MSDN is you need to know half the key words just to get near the right topic. In this partivular case after reading your question, I knew exactly what to look for. :smug:
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Hi!
The command, char* lltostr(long long value, char* endptr), are not defined in string?
How do I get it to work?
|
|
|
|
|
Not sure what it is your trying to do, you may have your wires crossed,
If you want to get a long value into a string format, you could do this:
long myLong = 1231213;
CString strLong;
strLong.Format("%d",myLong);
//strLong will then be "1231213"//////////////////////
or if the other way round...getting a long from a string
CString strLong = "1231213";
l = atol( s );
If you have to use a char[] and not a CString then do this, this is prob what you want to do.....
long myLong = 1231213;
sprintf( someChar, "%d",longvalue);
will give "1231213" in char[] named someChar
Is this what you mean???
Ross W
|
|
|
|
|
I have a COleDateTime object initialised in the following way.
COleDateTime m_ReadPointer = COleDateTime::GetCurrentTime();
I need to know a way to update the object to reflect the correct datetime given the TimeZone id. For eg. 1259
A Code snippet will be helpful
Dimple
|
|
|
|
|
GetTimeFormat(..) is ur solution, well sorry i dont have the code how to use it, but its parameters are pretty stright forward.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Well GetTimeFormat(..) doesnt have any timezone related stuff
|
|
|
|
|
Not sure what you mean but is it just a case off adding/subtracting a time
component to the COleDataTime, this can be done easily by the use of the
COleDateTimeSpan MFC class...
I could be misunderstanding the question though!!!
let me know and I will provide a code snippet
Ross W
|
|
|
|
|
Ok its got nothing to do with COleDateTimeSpan.
Actually i have a string like 1259 (for GMT), 1125 (for EST)
I need to use that string to update my m_ReadPointer object. so that any time i query for on it is in the timezone of the GMT/EST irrespective of the local system timezone.
Dimple
|
|
|
|
|
How does 1259 and 1125 reflect the time zone???!!???
|
|
|
|
|
I am lost since morning to find the co - relation.
Since a java applicationis giving me that value
Dimple
|
|
|
|
|
Hmmm... No idea but.....
look at java functions maybe its worth passing some other data like....
the TimeZone has an operation as follows
getOffset( int era, int year, int month, int day, int dayOfWeek, int milliseconds )
era = the era of the given date.
year = the year in the given date.
month = the month in the given date. Month is 0-based. e.g., 0 for January.
day= the day-in-month of the given date.
dayOfWeek = the day-of-week of the given date. )= Monday etc
milliseconds = the millis in day.
Returns
the offset to add *to* GMT to get local time, as an int
You could use this, couldn't you????
|
|
|
|
|
Exactly i was thinking on similar lines cos i do not find ne thing on the C++ side to associate with that Timezone id directly.
I will calculate the offset on the java side it self & give it to VC to add/subtract to the COleDateTime object
|
|
|
|