|
Hi
Thankyou again..
I will get back to you after following your instructiong. This time I believe your advice will be fruitful.
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi
Thank you very much. At last I got over it...
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
from C++ header files to UML class diagrams?
Hi everybody
Currently I do have C++ header files with class definitions (member variables and methods), no source files with implementations yet, it doesn't even need to compile yet and everything is in "design phase". From those header files I would like to automatically generate a UML class diagram, with bells&whistles (and all the arrows like dependencies, aggregations, etc.), so I can nicely show my bosses my suggestion for that future class concept. Does anybody of you know such a program to generate UML from header files?
I know that you could do it with "Together Solo" since I already did exactly that, but the new company I work at is very small and the piles of bucks you need to buy "Together Solo" are very big ($3500+).
Since I basically want to make some UML class diagrams I (of course) tried tools like ArgoUML and DIA. ArgoUML looks quite nice, but it's not really "finished" yet and... well... it's made for Java: I wasn't yet able to define pointers to classes as class members - and I do love pointers and I do need them. DIA is more "drawing" than "syntax checking" but the whole application crashed several times at my computer - so I'm not impressed.
I want to add that I am a coder guy: I prefer to write down all the derivations and dependencies right into a class definition than to draw some lines and arrows into diagrams (those arrows I want to be generated automatically). I even need no automatic code generation. As soon as I am confident in my design concept and my bosses nod I will start to code it again from scratch anyway, with code commenting and such.
Any help very welcome!
Thanks & Bye,
Matthias / T.T.H.
|
|
|
|
|
Hey everyone!
I am stucking a bit with my coding!
I need to check an ASCII-file, that was read into ONE std::string for some keywords.
The code is running fine (checking front and end character for Separators (' ','+','.', ...)), I am only getting in trouble, if my keyword is at the end of a line.
Anyone an idea how to check this case?
cheers, thomas
|
|
|
|
|
It sounds like one of the separators needs to be '\0' or '\n' in addition to the others.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hey!
Thanks alot!
Everything is working fine now!
Good luck for your own code projects!
thomas
|
|
|
|
|
hello
i have made a hardware for pc.
now i want to make a software for it.
i need code in vb.net,vb, c++, or visual c++ for
accessing usb port.if someone now plz notify me
note that i have already implement hardware through
parallel port. and it is working 100% correct.
|
|
|
|
|
I have PLC.I send byte.
I use following function.
BOOL CSerialCom::WriteByte(BYTE bybyte)
{
iBytesWritten=0;
if(WriteFile(hComm,&bybyte,1,&iBytesWritten,NULL)==0)
return false;
else return true;
}
This function is work.
But PLC is not display.
I want to know
(This device is really send or not).
|
|
|
|
|
WriteFile returns TRUE if the function succeeds. In your function, you return FALSE when WriteFile succeeds . That's not really logical... So the problem is with the WriteFile function (and the arguments you are passing to it).
|
|
|
|
|
Out to confuse the newbies, hmm?...
Here is his code (rewritten for clarity ):
<br />
BOOL CSerialCom::WriteByte(BYTE bybyte)<br />
{<br />
iBytesWritten=0;<br />
<br />
if( WriteFile(hComm,&bybyte,1,&iBytesWritten,NULL) == 0 )<br />
{<br />
return FALSE;<br />
}<br />
else <br />
{<br />
return TRUE;<br />
}<br />
}<br />
And here is, some of, the documentation for WriteFile:
If the function succeeds, the return value is nonzero.
So, this is actually perfectly valid code...
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Ouch... I read it too fast I didn't see the '== 0'
|
|
|
|
|
as title
and how to convert back the decimal integer to a byte array in c++?
|
|
|
|
|
Hello Ting,
I assume that your byte array is 4 bytes long. This is assumed because a decimal integer in the Intel platform is 4 bytes long. If you are working in another hardware platform, change my code below to suit the integral byte size of that platform :
// To convert from a byte array to an integer :
#include <memory.h>
int ConvertFromByteArrayToInt()
{
unsigned char ucArray[4] = { 0xFF, 0xFF, 0xFF, 0x7F };
int iInt = 0;
iInt = *((int*)(ucArray));
return iInt;
}
// To convert from an integer to a byte array :
void ConvertFromIntToByteArray()
{
unsigned char ucArray[4] = { 0, 0, 0, 0 };
int iInt = 2147483647;
memcpy (ucArray, (void*)((unsigned char*)&iInt), 4);
}
Best Regards,
Bio.
|
|
|
|
|
Hello Ting,
I assume that your byte array is 4 bytes long. This is assumed because a decimal integer in the Intel platform is 4 bytes long. If you are working in another hardware platform, change my code below to suit the integral byte size of that platform :
// To convert from a byte array to an integer :
#include <memory.h>
int ConvertFromByteArrayToInt()
{
unsigned char ucArray[4] = { 0xFF, 0xFF, 0xFF, 0x7F };
int iInt = 0;
iInt = *((int*)(ucArray));
return iInt;
}
// To convert from an integer to a byte array :
void ConvertFromIntToByteArray()
{
unsigned char ucArray[4] = { 0, 0, 0, 0 };
int iInt = 2147483647;
memcpy (ucArray, (void*)((unsigned char*)&iInt), 4);
}
Best Regards,
Bio.
|
|
|
|
|
If I understand your question, the easiest solution would be to use a union . Something like:
union
{
BYTE b[4];
int n;
} u; Now if u.b were assigned values such as:
u.b[0] = 120;
u.b[1] = 86;
u.b[2] = 52;
u.b[3] = 18; Then u.n would have a value of 0x12345678. No "conversion" necessary.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks Bio~
However, i know the size of the byte array. So, do i convert it to a char[]?
and how to convert it?
|
|
|
|
|
Hello David,
That's a great idea indeed ! Using a union is absolutely brilliant !
I have a further suggestion :
union
{
BYTE b[sizeof(int)];
int n;
} u;
Instead of hardcoding the size of the array, I thought we could set this to the byte size of an integer. This code will ensure platform independence.
Thanks, David.
Best Regards,
Bio.
|
|
|
|
|
Hello Ting,
The size of the byte array must be exactly 4 bytes in intel platforms (4 bytes being 32 bits).
The reason why I use an "unsigned char" array is because a byte in programming terms is essentially an unsigned 8-bit character. So use "unsigned char" instead of "char".
If your byte array is smaller than 4 bytes, reset it to 4 bytes and pad the missing bytes with zero. E.g. :
instead of :
// Byte array to represent 0x00112233.
unsigned char ucByteArray[3] = { 0x33, 0x22, 0x11 };
make this :
// Byte array to represent 0x00112233.
unsigned char ucByteArray[4] = { 0x33, 0x22, 0x11, 0x00 };
Remember the byte ordering of Intel platforms : a two byte short integer with value 0x1122 is represented in memory bytes as :
0x22 <-- first byte.
0x11 <-- second byte.
Your byte array must not be larger than 4 bytes. This would be an error.
Best Regards,
Bio.
|
|
|
|
|
Hello Ting,
Additional info (which I think you already know but I just want to clarify) : The byte ordering information that I just mentioned pertains only to Intel machines. Please find out the byte ordering information of the target machine you are working on.
Also, I mentioned that your byte array must not be larger than 4 bytes. This is assuming that you are working on the Intel platform. You could be working on a machine with a 64 bit processor which will make the byte size of an integer 8 bytes. In this case, your byte array should be no larger than 8 bytes.
Just to clarify,
Bio.
|
|
|
|
|
i use it at windows platform (include winxp, 98, me, and pocket pc 2003). Do they are "Intel platform"? Thanks
|
|
|
|
|
Hello Ting,
The Intel platform is what we commonly refer to as the PC (personal computer). The Macintosh is not the Intel platform (the Mac uses the Motorolla chip, last time I remember).
WinXP, 98, ME all run on the PC and so they do run on the Intel platform.
The Pocket PC 2003 is the OS behind PDAs which do not use the Intel chip. Even if they do, they may not be 32-bit based.
One simple but effective way to check out the byte size of an integer in whatever target platform you are working on is to use the "sizeof" operator. E.g. :
memcpy (ucArray, (void*)((unsigned char*)&iInt), sizeof(iInt));
notice my use of sizeof(iInt) instead of hardcoding this to 4.
Regards,
Bio.
|
|
|
|
|
Hi,
How can we change the font and text color of an edit control(CEdit class)
using CFontDialog ?
Thanx in advance
Rgds
Sunil
|
|
|
|
|
CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
LOGFONT lf;
memcpy(&lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
//CFont m_font as class member
VERIFY(m_font.CreateFontIndirect(&lf));
GetDlgItem(IDC_EDIT_MYTEST)->SetFont(&m_font);
}
There is no spoon.
mail
|
|
|
|
|
--------------------------------------------------------------------------------
Hello,
I am working with MDI application. When I maximize my main window, my child windows should also be maximized.I want my childd window to be maximized whenever Mainframe window is maximized.Can anyone please help me to do this?
Thanks
Madhavi
|
|
|
|
|
Handle WM_SIZE for Main Window.
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|