|
Thanks for that link... actually it doesn't tell me why I should use one or the other. There table in that page lists two differences between CArray and CStringArray: 1. The former uses templates while the latter doesn't - well, that is obvious. 2. CArray isn't type safe while CStringArray is - but I fail to see why. A CArray<CString, LPCTSTR> can only contain CString objects, so what should be type unsafe? So actually, my question remains open
Regarding your advice, I have to deal with tons of old code. Many parts of that code work well with Unicode, but I know some places that confuse bytes with characters, and I sure don't know all of them, and I just don't have the time to clean everything up. I will have to live with a mix of 16 and 8 bit character strings. Besides, it is a pity that there is no built-in or MFC UTF-8 string type in C++. I love Perl for that.
|
|
|
|
|
I'm pretty sure that CStringArray and CArray<CString> provide the same functionality. If later you find out then its still an easy search and replace. I wouldn't worry about this choice. I myself prefer templates as in some cases templated containers are easier to handle (from other templates) than specific types like CStringArray.
|
|
|
|
|
They provide the same functionality, though CStringArray is faster to add strings (it is specialized, so that makes sense.)
|
|
|
|
|
Hello,
I got a question about the Win API with C++,
Some problems in the use of the
OpenComm(mbPortName, INQSIZE, OUTQSIZE);
The "COM1" to "COM32" is OK! But The "COM32" or higher always return error.
The function can't return ID to me.
How can I modify my parameter to solve this problems.
Thank you.
|
|
|
|
|
OpenComm is now obsolete.
Use CreateFile instead as follows -
CreateFile(_T("\\\\.\\COM25"), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
|
Thank you very much.
But my project is develop in Visual studio 6.
There is no other way to do it?
|
|
|
|
|
CreateFile is part of the Win api and has nothing to do with the version number of the dev studio you are using.
|
|
|
|
|
Thank you.
I am try to convert the code to "CreateFile" funciton.
|
|
|
|
|
Does COM32 exist? Can you open it in hyperterminal? Does something else already have it open? Is it an exclusive device? Is it in device manager? Does it have a modem attached to it?
|
|
|
|
|
I can open COM32 or Higher in hyperterminal.
It is an exclusive device, and the device is "MOXA" device.
The one is support COM1 to COM256 that is use a configuration UI to setting it.
I can change any port to different COM port. and request and response data is ok in hyperterminal.
|
|
|
|
|
Next thing to consider is permissions. In CreateFile you have to specify the permission level you want. Use MAXIMUM_ALLOWED, that way the open will always succeed and give you whatever permissions it can. If yuo ask for FULL_CONTROL, and you dont have ownership of the object, then it will fail to open.
|
|
|
|
|
Thank you very much.
I am try to convert the Opencomm function to CreateFile function.
There are many function and logic need to modify.
Thank you a again.
|
|
|
|
|
Hello,
I have a size problem with a header file.
The header file contains a big array. (OpenGL model)
When I want to compile the program, I get
the error that the file is to big.
I'm using Visual Studio 2010.
Thanks for your answers.
Regards
Andy
|
|
|
|
|
andreas04 wrote: When I want to compile the program, I get the error that the file is to big. I would suggest you need to make it smaller; what is the complete text of the message?
Use the best guess
|
|
|
|
|
Put the array in a source file.
|
|
|
|
|
andreas04 wrote: When I want to compile the program, I get the error that the file is to big. This makes no sense. How big an array is and how big a file is are two separate issues. Be more specific, please. If you are running out of stack space, you might could try increasing the stack size (default is 1MB).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
How is putting a global variable in a header file going to use stack space?
You know of course global variables and those labled 'static' go into static memory (ie the process address space allocated for the program to run) and are initialised to zero?
|
|
|
|
|
Sorry that is not true at all and all very misleading by everyone.
Visual studio follows a generic normal
What will happen with "static" depends on if they are initialized to zero or not.
Zero initialized static data goes in .BSS segment
initialized static data goes into the Data segment
You can however override all this in Visual Studio and move the data around using the #pragma directive
http://msdn.microsoft.com/en-us/library/azbwewbt.aspx[^]
int i; #pragma bss_seg(".my_data1")
int j;
#pragma bss_seg(push, stack1, ".my_data2")
int l;
#pragma bss_seg(pop, stack1) // pop stack1 from stack
int m;
int main() {
}
"const" go in the const_seg
http://msdn.microsoft.com/en-us/library/1dc22465.aspx[^]
const int i = 7; const char sz1[]= "test1";
#pragma const_seg(".my_data1")
const char sz2[]= "test2";
#pragma const_seg(push, stack1, ".my_data2")
const char sz3[]= "test3";
#pragma const_seg(pop, stack1) // pop stack1 from stack
const char sz4[]= "test4";
|
|
|
|
|
I actually need to find the SD card number serial number so that I could distinguish between SD cards with a unique key.
Please suggest...!!!
|
|
|
|
|
|
Hello!
In my linker I get an error:
[bcc32 Error] Unit1.cpp(109): E2316 'GetScanline' is not a member of 'TBitmapData' Full parser context Unit1.cpp(42): parsing: void _fastcall TForm1::Button1Click(TObject *)
But I can clearly see it here
Embarcadero API TBitmapData
Actually I have only 3 methods in TBitmapData - Pitch, GetPixel and PixelFormat. That is strange.
What should I do to use GetScanline?
I use Embarcadero RAD Studio XE3. And Firemonkey.
Thanks!
modified 9-Jul-13 7:40am.
|
|
|
|
|
This looks more like a compiler error. Check the header file for this class to see where GetScanline() is defined.
Use the best guess
|
|
|
|
|
If you take a look at the link I provided - in the footer of the page (descriprion part) only these methods are described, but in the header of this page GetScanline is also mentioned like void * __fastcall GetScanline(const int I);
Anyway I need some function instead of too slow GetPixel.
Sorry for my English.
|
|
|
|
|
Okay, I looked inside header file. There is no GetScanline.
Why is it mentioned in API and what should I do now?
|
|
|
|
|
Member 10100948 wrote: Why is it mentioned in API and what should I do now? Contact the people who provide this library and ask them.
Use the best guess
|
|
|
|