|
It depends which Turbo C++ you are using. If it is the ancient character-based one (looks like a DOS screen), then it generates 16-bit code. If, however, you use the more modern one (ca 2005, looks like a real Windows IDE), then it generates 32 bit code, even for console apps.
HTH
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
|
Yes you are right.
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
|
It's not a bad description to start with as all DOS programs start life as 16 bit programs. The calling convention for DOS was all real mode and register based so most parameters had to be 16 bit. If you wanted to pass 32 you had to use a structure or pack them in two registers.
However while all DOS programs start execution as 16 bit, by the early 90s most were starting to branch out a bit and would switch to either 16 or 32 bit protected mode fairly quickly, switching back to 16 bit real (or V86) mode when they needed to make system calls. it was a complete rat's nest and you're better off ignoring it unless you're interested in how the whole sorry mess evolved in the name of compatability.
Cheers,
Ash
|
|
|
|
|
oh. haha. hhmmm... nice. i am already out of that for the past 4 years. but still just a little love on it cause i have lived a lot with Turbo C++ and trying to mimic the same in windows like the interrupts for monitoring processes like file system.
thank you.
|
|
|
|
|
Hey, sorry if the threadtitle is a bit in-informative but I didn't know what to call it.
Ok now to my problem, I am playing around with arrays and stuff see here ->
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a[] = { "one", "two", "three" };
for (int i = 0;i <3;i++)
{
cout << a[i] << endl;
}
cin.get();
}
Now my problem is the "i < 3" let's say I wouldn't want to change that everytime i add another string to my array.
How would I do that?
Greetings!
|
|
|
|
|
there is a ARRAYSIZE macro you can use : ARRAYSIZE(a).
#define ARRAYSIZE(a) sizeof(a)/sizeof(a[0])
i don't recommend it. but it should work.
|
|
|
|
|
|
If you are using Visual C++ you can use the macro _countof(x) which returns the size of the specified array. In your case you have to write i < _countof(a)
|
|
|
|
|
I actually am using VC++, thanks for your answer!
|
|
|
|
|
You are welcome! 
|
|
|
|
|
What's wrong with asking the compiler how big the array is - it knows, it bunged the thing on the stack for you:
template <typename T, std::size_t N>
std::size_t sizeof_array( T (&)[N] )
{
return N;
}
Most decent compilers (VC++2003, 2005, 2008 and 2010, gcc 3.3 onwards) will inline that to a constant. You can extend it a bit...
template <typename T, std::size_t N>
T *beginning_of_array( T (&a)[N] )
{
return a;
}
template <typename T, std::size_t N>
T *end_of_array( T (&a)[N] )
{
return &a[ N ];
}
which means you can get away from using indexes entirely and start using algorithms to do the sort of thing you're doing in your example:
int main()
{
std::string a[] = { "One", "Two", "Three" };
std::copy( beginning_of_array( a ), end_of_array( a ), std::ostream_iterator<std::string>( std::cout, "\n" ) );
}
From there you're not far away from using overloaded functions to come up with a generic way of handling different aggregates of things.
Cheers,
Ash
|
|
|
|
|
Hi,
I am using default scrollbar for window. In OnSize i am calling SetScrollInfo() function whenever i am resizing the window. But in some situation the scrollbar is getting hidden, if i reduce or increase the size again scrollbar is becoming visible again. I checked the min and max position values but they are correct.
|
|
|
|
|
Are you also resetting your scroll ranges in your paint routine? You need to do this in order to take account of the current client window size and the amount of information you can display relative to the amount of information available. Remember that these values can change just by using a different size font for text or zooming an image.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Thanks a lot, it worked after doing the changes suggested by you.
|
|
|
|
|
You're welcome.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hello Friends
I am creating a application using GDI/PLus to save tiff as multiPage.
I got the Image object And tried
Image img;
img.save(..,..);
And its working fine
Then I used
img.saveAdd(..,..)
to add other images.but its not working.
And It is accepting one parameter as EncoderParameter which is having option to set multi Frame as I think as I found tht type in c#.
Do anyone is having idea how can I add image as MultiPage.
Thanks In Advance.
Regards
Yogesh
|
|
|
|
|
Hi,
Lets say, I am having Vendor dll and it is non-unicode.
I want to use this dll in my Application and it is unicode.
DLL is built using SDK functions such way that I cannot make is Unicode, same with Application it cannot build without unicode (frame work dependencies). Both of them are using CString.
Is there any way possible by which I can use this dll in my application without changing their nature?
Please let me know if further clarification needed.
Thanks in advance.
|
|
|
|
|
It should be easy enough. Just make sure when calling the vendor supplied DLL to use explicit specialisations of CStringT e.g. CStringT< char, ChTraitsCRT<char> > . It might be a good idea to use a typedef for this.
Oh, one other thing - make sure that around including the header for the library TCHAR is defined as char and not wchar_t or the functions won't link properly.
Cheers,
Ash
PS: Looks like there are already typedefs in MFC for this sort of thing. Have a look in Alain's answer below for their names!
modified on Thursday, October 28, 2010 8:28 AM
|
|
|
|
|
Hi,
From VS2003 the MFC (or ATL) CString classes are specializations of CStringT : see http://msdn.microsoft.com/en-us/library/5bzxfsea(VS.71).aspx[^]
Explicitly use CStringW for your framework related code and CStringA for interaction with your DLL.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi,
I am sure the "file.exe" is not running. But when I tried to re-build the exe file. VS 2008 gives this error.
Please help.
Thanks,
|
|
|
|
|
can you rename the file? if not, it is locked by some process.
can you delete the file? if so, doing that could solve it.
|
|
|
|
|
Yes, I can rename and delete it. But it is painful to delete the EXE file for every build.
Do you have any other solution?
I guess it is caused by the windows 7 security.
Thanks,
|
|
|
|
|
I haven't encountered such situation on Win7 yet. If you can delete it, the EXE isn't executing any more (as it would when you had some non-main thread that goes on while not being marked background).
Here is one work-around idea: add a pre-build step to your Visual project, deleting the EXE with a DOS-like command, which you enter somewhere in the project's settings dialog.
|
|
|
|