|
And how do you communicate with the microprocessor ? You receive data for example on the serial port ?
I don't think this is a great idea to store everything in a CString. They are used for string manipulatino and not as data buffer (I suppose that the data you are receiving is not only characters but also 'binary' data). And why not open a file at the begining of the communication and store everything there. Or even write your own data class that will take care of the format of the data. This could be quite fast if you design it well.
|
|
|
|
|
Aljechin The input comes extremely fast
What does this mean? Compared to what? Using what medium (serial, ethernet, USB)?
When I face such a problem I tend to separate the data collection from the analysis.
I store the collected data in BLOBs, put them into a queue and analyze them in a separate thread.
Usually the analysis is non-critical regarding time compared to data collection.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Actually the program here is in Plain C with some asm stuff. But this question just came into my mind. I cannot use a CString even if I want it here. The data comes through a serial port. Actually there are two other layers after the microprocessor, from where the data comes to our program.
Thanks
|
|
|
|
|
Aljechin The input comes from a microprocessor Aljechin The input comes extremely fast
If we are talking about currently commercially available PCs, "extremely fast" may be anything more than Gigabit-Ethernet.
In our company, we have a machine tha can generate data in a pace of about half of the capacity of a off-the-shelf IDE-Disk. (Not or long, though).
This is handeled in C++ on a standard PC.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
InfiniBand - the only way to fly!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
That is ~205KB of data, which is a small amount of data in today's world.
Note that if you are copying the data directly into the CString in one shot, the performance will be MUCH better than if you keep appending into the CString .
If you need to be messing around with individual pages or lines a lot, you might want to use something else like an embedded editor (a hidden edit/richedit control, for example), or your own implementation of a text-row table (and array of pointers, one for each page/line) or something like that.
Lastly, it might be worth making sure that the function HAS to take a CString - there are lots of examples of poorly-designed code that take CString parameters unnecessarily, when a simple LPCTSTR would work fine.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Lastly, it might be worth making sure that the function HAS to take a CString - there are lots of examples of poorly-designed code that take CString parameters unnecessarily, when a simple LPCTSTR would work fine.
What really makes me twinge is when they specify a CString& - by reference! when an LPCTSTR would have been just fine
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
I need Introduce Yourself to Vc++ Part II,III,IV.Send it for me,please?I'm sorry because my English is bad.send to manhhung_luu@yahoo.com,please.
|
|
|
|
|
|
|
MSDN for MessageBoxEx clearly say: if message box doesn't have Cancel button ESC has no effect on message box. But in reality I can not reproduce this behaviour. My message box allways reacts on ESC, although I have only OK button on it. How to prevent this? And if I already have just OK button on it, that means I want 'X' button to be disabled (if not erased). Is there any solution for this? I hope there is and that someone will share it with me.
Thanks
Doctor Celic
|
|
|
|
|
You could overwrite the CDialog::OnCancel() method - that worked for me. Good luck!
|
|
|
|
|
OK, maybe I was not clear enough. Is it possible to use MessageBox API functions and as a result to have message box which doesn't react on ESC and with 'X' button disabled?
Doctor Celic
|
|
|
|
|
OK - first, the documentation is incorrect for the message box functions. There is a little known fact about the internals of standard message boxes that use MB_OK - that is actually a IDCANCEL button with a label of "OK". That is why you can dismiss that kind of message box using ESC or ENTER .
Second, as of Windows XP, there is no difference between using MessageBoxEx(...) or MessageBox(...) , so if you are using the Ex version, you might want to make sure you know what you are doing with it...
Lastly, I do not think that there is a way to do that without doing something like implementing your own message box-like function from scratch, or doing something like creating a Yes/No message box and then hooking its creation, relabeling one button to "OK", centering it, and hiding the second button. You might also have to handle mnemonic actions for the hidden button, though...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi Friends,
How sizeof operator works? Is it get resolved compile time? Can I write function which do the exact job of sizeof operator ? It should run on any platform and shows size of any declared variable like int,double...
VikramS
|
|
|
|
|
Isn't "sizeof" a reserved keyword? If yes, then it's resolved by the compiler.
|
|
|
|
|
yes it is...But How it works?
|
|
|
|
|
It doesn't 'work' . It is like asking how 'return' or 'class' works. It is a keyword, so there is no function associated with it.
|
|
|
|
|
Well,
I agree that it's key word and get resolved that compile time. But
there must be some funcionlity associated with it,
like
1) keyword return: make code to return from function call and populate AX register value with return value if any
2) keyword class : at design time desides type and memory layout of your custom data type.
so finally they are there to tell compiler to do some job...What about sizeof...does it tell compiler to do some job? so what is it?
|
|
|
|
|
man, stop persisting in this way.
all you can code will be resolved at runtime, not compile time... so, one again, you CANNOT do this.
keywords class and/or return don't produce code like a function does. the compiler associate some assembler instruction to them, but they don't execute specific code. what code did you like class to execute ??
one question though : why do you need this ?
|
|
|
|
|
v2.0 says:
all you can code will be resolved at runtime, not compile time... so, one again, you CANNOT do this.
comment :
A class defination. get's resolved at run time???
|
|
|
|
|
you don't code it... you tell the compiler how the memory is structured
do you use any if , for , return , break etc... instructions in class definitions ?
|
|
|
|
|
Yes, it is a compile time operator, and it resolves to a constant value.
No, I do not think that it would be easy (if possible at all) to write a function that provides the same information. For example, RTTI's type_info class does not provide size information, and comparing stack addresses/locations would be iffy due to alignment issues.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
sizeof is a language operator, which you cannot recreate.
consider this:
class CMyClass {
char[MAX] m_arr;
CAnotherType m_at;
};
CMyClass c;
sizeof(c);
can you know what this will resolve ?
no, simply because
1) you can't know all user defined types
2) you don't know the stack alignment
3) the size might be plateform dependant
|
|
|
|
|
Please don't consider my problem statement for creating a new sizeof operator.I just wanted to have a function which will produce the same result.
Also if possible how compiler finds of sizeof any variable on different hardware platforms?
|
|
|
|