|
the compiler is probably treating '\40\40id' as a numeric literal (which causes the machine's byte-order rules for numerics to get involved).
it probably sees ' id' as a string literal (even though you shouldn't put multiple characters inside single quotes), and ends up doing something like:
char *p = " id";
long f = *(long*)p;
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
hmmm ... strange things happens ...
i tried this one here ...
char *p = "\0\0id";
long f = *(long*)p;
if running this code f results in 0x64690000 ... that's exactly the same what the compiler generates with the constant '\0\0id' .. and that's swapped compared to 'id' which results in 0x00006964 ?!?!?!?!
this is one of the days where i don't understand compilers ... i want that the compiler generates the same constant when i write 'id' and '\0\0id' because this is obviously the same (for me!)
cheers
tilo
|
|
|
|
|
bytefactory wrote: i want that the compiler generates the same constant when i write 'id' and '\0\0id' because this is obviously the same (for me!)
how about:
long f = (0x00) << 24 | (0x00 << 16) | (0x69 << 8) | 0x64;
?
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
that would work but make a lot of work at another place in the program because i use the includefiles are parsed with an own scripting language that understands only 'xxxx' and numbers
thanks for the suggestion ...
tilo
|
|
|
|
|
This is just a shot into the blue, but isn't Unicode basically not a system type? Like, int would be "swapped" on little endian/big endian" but unicode would be the exact same binary pattern?
I remember being lectured on something like that, but I might be way off here.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
How to create a new window(child window) from menu list...and also from toolbar?
|
|
|
|
|
I did'nt get your question..Please add more information
|
|
|
|
|
what is a window ?
i give you the example for a new dialog box. if you want something else, make the conversion.
when you click on a toolbar button, on on a menu item, handle the WM_COMMAND event that is thrown, and overload it :
void OnSClickMenuAbout() {
CAboutDlg dlg;
dlg.DoModal();
}
(here i consider you open the "About" DialogBox on clicking its item in the menu...)
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Anu_Bala wrote: (child window)
may be she must be talking about MDI.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
i only gave an example...
the
CAboutDlg dlg; line can be replaced with something like :
CChildFrame frm(this); where this is the parent for instance...
i hope the guy can search for infos by himself, and not waiting for everything well done and well written, until he just have to copy/paste the solution in his code...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
hmmmm
OT:How was your holidays buddy?
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
VivekuniQ wrote: How was your holidays buddy?
hummm, very nice !!!
i took time with soome of my friends i didn't see since almost 1 year...
i saw back my little brother an my mom'... enjoyed the fresh snow of the alps... got very tired to go to bed late every nights
but now, everything's ok. i'm back in the sweet arms of my girlfriend, i've signed for a new contract at the office, so, Year 2006 starts very well for li'le tox' !! :->
and you ? what did you do during these 2 weeks ? and how are you buddy !?
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
toxcct wrote: and you ? what did you do during these 2 weeks ? and how are you buddy !?
Just a moment!. attendez monseiur.i'll be back.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
toxcct wrote: i'm back in the sweet arms of my girlfriend,
Great , congrets
toxcct wrote: Year 2006 starts very well for li'le tox' !!
yep seems too
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
please help me...
i want to run c++ program on linux platform so what is the process for this .
if any one have tutorial for linux support C++ then please forward me....
bankey.khandelwal@solversa.com
Thanks N Regards
Bankey Khandelwal
Mobile : 98504-32990
Office : 020 25521888
Solversa Technologies
15, Yeshwant Ghadge Nagar,
Range Hill Road,
Pune - 03,Maharashtra,India.
|
|
|
|
|
have you heard about compilers?
I think there are compilers in linux too and probably the best one (ppl say that) its called gcc.
-Prakash
|
|
|
|
|
Mr.Prakash wrote: the best one [...] called gcc
just a correction.
gcc knows C.
g++ know C++.
moreover, this is maybe the best thing to do to recompile the project. however, if the program is designed for windows specific libraries, they won't work under linux (and won't even compile - for e.g. MFC...)
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
toxcct wrote: just a correction.
gcc knows C.
g++ know C++.
so should that not been gc
-Prakash
|
|
|
|
|
just a nitpick:
gcc[^]: "The GNU Compiler Collection is a full-featured ANSI C compiler with support for K&R C, as well as C++, Objective C, Java, and Fortran."
g++[^] : "g++ is the traditional nickname of GNU C++, a freely redistributable C++ compiler. It is part of gcc, the GNU compiler suite, and is currently part of that distribution."
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
If your program is created with plain C++ without the support of any MS specific libraries, then it should compile fine with Linux compilers. Linux has several editors as well, I use Kate for C++ Programming. You have to compile and run program from shell (similar to command-prompt in Windows).
And Yes, if you are using any Windows APIs etc, you will have to replace those with Linux specific things. C++ is not platform independent, therefore, you have to tweak your program to run it on Linux. Start it, You will be through. Its not that difficult.
Regards,
|
|
|
|
|
|
Bankey Khandelwal wrote: i want to run c++ program on linux platform...
Which makes no sense at all. Machines don't care what high-level language you used to create the application. As long as the binary matches the target platform, you're good to go. Now if you wanted to compile C++ code on a Linux box, that's a different animal altogether.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I developed a VC++ application and now I need to support UNICODE to show Hebrew strings into a CListCtrl. I added the declaration:
#define _UNICODE
but now I obtain several error during the compilation process:
error C2664: 'int ATL::CStringT<basetype,stringtraits>::Find(ATL::CSimpleStringT<basetype,t_bmfcdll>::XCHAR,int) throw() const' : cannot convert parameter 1 from 'const char [11]' to 'ATL::CSimpleStringT<basetype,t_bmfcdll>::XCHAR'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC_DLL<wchar_t>,
t_bMFCDLL=true
]
and
[
BaseType=wchar_t,
t_bMFCDLL=true
]
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
This is because I used string constants without the _T("..."); prefix.
In my application there are several strings without _T prefix so I wanted to know if exist a workaround to use UNICODE without the intoruduction of _T prefix.
Remember that I need to display Hebrew strings.
Thank you
|
|
|
|
|
wollet wrote: In my application there are several strings without _T prefix so I wanted to know if exist a workaround to use UNICODE without the intoruduction of _T prefix.
I think you have to replace all strings without _T(...) with _T(...), it is one good way to avoid any future problems too.
Actually its a good practice for UNICODE aware program to always include the strings in _T() macro.
-Prakash
|
|
|
|
|
Firstly defining just "_UNICODE" is not enough - You need to define both "UNICODE" and "_UNICODE". "UNICODE" effects the Windows headers and "_UNICODE" the C runtime library. Make sure you "undefine" (remove) any "MBCS" defines. It would be best to make these definitions by altering the project settings and not be putting "#define"s in your code. Other peoples comments on the use the the "_T" or "_TEXT" macros apply.
Steve
|
|
|
|