|
but where is mailMonty??
VuNic
|
|
|
|
|
|
VuNic wrote: but where is mailMonty??
got me
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
hi thank you, but first is not working ?
__int32 x = 0;
char s[4] = {'a','a','a','a'};
x = s[0]+s[1]<<8+s[2]<<16+s[3]<<24;
cout<<x;
when i run the proram i get such output x = 0
the second variant is not working correctly too, I get output : 1633771873 instead of 3267543746
thanks
-- modified at 4:34 Wednesday 22nd March, 2006
|
|
|
|
|
i don't know why the 1st is not working... it should !!
however, be sure that that operator<<() is overloaded for __int32
for the union solution, it works because the memory blocks overlap, so your int is automatically filled with what you write in your char[4]...
|
|
|
|
|
please view my previous post I modified it
|
|
|
|
|
big_denny_200 wrote: instead of 3267543746
How do you know this is correct!
This is my result...
3861616161
Nibu thomas
Software Developer
|
|
|
|
|
I was wrong the result was correct.
As I said I had array of four chars
char s[4] = {'a','a','a','a'}
integer value of 'a' = 97 (1100001)
theretfore the result was correct
01100001 01100001 01100001 01100001 (1633771873)
thanks to everybody
|
|
|
|
|
as nibu said, how can you be sure it prints the incorrect value ?
if printf("%X", x) displays 0x61616161 (1633771873 in decimal), then everything is ok (according that 'a' is 0x61)
|
|
|
|
|
Fine on a little endian architecture but would fail on big endian.
OK I'm being picky but work with both
The tigress is here
|
|
|
|
|
Trollslayer wrote: but Fine on a little endian architecture but would fail on big endian.
OK I'm being picky but work with both
but Fine on a little endian architecture but would fail on big endian.
OK I'm being picky but work with both
every element in char c[4]={'a','a','a','a'} is same so little or big endian architecture is not problematic
never say die
|
|
|
|
|
I have a simple application in VC6.0 and ported it to .NET 2003.
I set "Use Managed Extensions" to Yes from the Project Properties->Configuration Properties->General because am using #using .
i get the foll error
Command line error D2016 : '/RTC1' and '/clr:initialappdomain' command-line
options are incompatible
i saw a lot of articles on this which suggested to do the foll to solve this error: i.e.
Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
Click the C/C++ folder.
Click the Code Generation property page.
Modify one or both of the following properties: Basic Runtime Checks or Smaller Type Check
i tried changing options under Basic Runtime Checks but to no avail?
i still get the error?
How can I solve this command line error?
Pls help!
Sincerely
Giftsana
|
|
|
|
|
Hi,
How can i use print / print preview from a dialog in a DOC/VIEW Architecture since the onPrint is a CView member ?
Regards,
sdancer75
|
|
|
|
|
hehe, i think u can place a button to call the OnPrint message.
|
|
|
|
|
Hello everyone,
I think we can use LoadLibrary to load a .dll file and use its published interface. I am wondering whether there are some methods to un-load a library (which is adverse to LoadLibrary)?
thanks in advance,
George
|
|
|
|
|
|
Thanks Rick!
This link is dealing with how to load a library. But my question is about how to unload a library.
regards,
George
|
|
|
|
|
|
Hi Mihai,
This method is very useful. After reading through related MSDN documentations, I have two questions about this,
- How to verify that the library is unloaded? How to write a simple program to verify that the library is real unloaded by the application -- maybe I can try to invoke some functions provided by the .dll after unloading it? Do you have any ideas?
- Is the method FreeLibrary Microsoft C++ standard or standard C++ standard? Could it be used in C program?
Thanks a lot!
regards,
George
|
|
|
|
|
Hi George,
1) the FreeLibrary function is returning a TRUE/FALSE value to verify if it's unloaded, and you shouldn't invoke other function after you unload it (my advice).
2) that's a Microsoft Windows method specific and it's not in the pure C++ language.
|
|
|
|
|
Thanks Mihai,
If I want to use it in pure C++ language, which similar method should I use?
regards,
George
|
|
|
|
|
I need help.I am trying to get the dc of a GDI+ Bitmap dirctly
During runtime i am loading the image in Gdiplus::Bitmap m_gdipBmp;
with out showing it dirctly into view i want to get the dc of this bitmap
I have used this code
Gdiplus::Graphics g(m_gdipBmp);
HDC hDC = g.GetHDC();
but i am not getting the proper dc
|
|
|
|
|
I have some code which is generate by VC6.0 sp5, it is a SDI based project. When i compile it in VS.NET 2005, there are a lot of errors and warnings, and i don't want to rewrite my code? what should i do then? help me please!
|
|
|
|
|
Can you please tell me what kind of errors do you get? Maybe I can help you!
|
|
|
|
|
First: I drag the project file XXX.dsw directly to the .NET IDE, it give me a tip to convert this project, i choose yes. After convert it, i press F7 to build the solution, its errors are:
------ Build started: Project: PWSpy, Configuration: Debug Win32 ------
Compiling...
StdAfx.cpp
Compiling...
Gradient.cpp
d:\workshop\file system\all codes\monitor ap\pwspy\gradient.cpp : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\gradient.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\gradient.cpp(179) : error C2065: 'i' : undeclared identifier
MainFrm.cpp
d:\workshop\file system\all codes\monitor ap\pwspy\tballoon.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\gradient.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(88) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(89) : error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall CMainFrame::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(90) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(94) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(UINT,LONG)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(95) : error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(96) : error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall CMainFrame::* )(UINT,DWORD)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(97) : error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall CMainFrame::* )(UINT,DWORD)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
None of the functions with this name in scope match the target type
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(1421) : error C2065: 'nDevIndex' : undeclared identifier
d:\workshop\file system\all codes\monitor ap\pwspy\mainfrm.cpp(1913) : error C2593: 'operator +=' is ambiguous
d:\microsoft vs .net 2005 ide\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1372): could be 'ATL::CStringT<basetype,stringtraits> &ATL::CStringT<basetype,stringtraits>::operator +=(wchar_t)'
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
d:\microsoft vs .net 2005 ide\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1365): or 'ATL::CStringT<basetype,stringtraits> &ATL::CStringT<basetype,stringtraits>::operator +=(unsigned char)'
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
d:\microsoft vs .net 2005 ide\microsoft visual studio 8\vc\atlmfc\include\cstringt.h(1358): or 'ATL::CStringT<basetype,stringtraits> &ATL::CStringT<basetype,stringtraits>::operator +=(char)'
with
[
BaseType=char,
StringTraits=StrTraitMFC_DLL<char>
]
while trying to match the argument list '(CString, int)'
PWSpy.cpp
d:\workshop\file system\all codes\monitor ap\pwspy\pwspy.cpp(144) : warning C4996: 'CWinApp::Enable3dControls' was declared deprecated
d:\microsoft vs .net 2005 ide\microsoft visual studio 8\vc\atlmfc\include\afxwin.h(4471) : see declaration of 'CWinApp::Enable3dControls'
Message: 'CWinApp::Enable3dControls is no longer needed. You should remove this call.'
PWSpyDoc.cpp
PWSpyView.cpp
TBalloon.cpp
d:\workshop\file system\all codes\monitor ap\pwspy\tballoon.cpp : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\tballoon.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\gradient.h : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
d:\workshop\file system\all codes\monitor ap\pwspy\tballoon.cpp(163) : warning C4018: '<' : signed/unsigned mismatch
Generating Code...
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 8.00.50727
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://d:\WorkShop\File System\All Codes\MONITOR AP\PWSpy\Debug\BuildLog.htm"
PWSpy - 10 error(s), 9 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
|
|
|
|