|
Hi friends,
i have an application which takes some inputs from a [B]SERIAL PORT RS232[/B] , so for using that application which is installed on some other system i need to desgin a mediator which will send command to that aaplication through my [B]SERAIL PORT[/B] so friend s please provide me some help how to start with such module which interacts with Serial port.
Also i have one query if i install both software my [B]HOST(WHICH PUSH COMMANDS TO CONTROL SYSTEM)[/B] AND [B]CONTROL SYSTEM(WHICH ACCEPTS COMMANDS AND SENDS BACK ACKNOWLEDGEMENT TO HOST)[/B] then will they be able to interact fine or i need to install them on diffrent machine and connect them through SERAIL CABLE.
waiting for a reply
deepak
|
|
|
|
|
The simplest method is use
<code>hPort = CreateFile ("COM1",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);</code>
Look in the MSDN for "Programming Serial Connections", this should be OK unless you need something more advanced, but I don't think you do.
<HR SIZE=1 /HR>
<i>If I have seen further it is by standing on the shoulders of Giants.</i> - Isaac Newton 1676
|
|
|
|
|
Thanks Ted,
I have written code, there is no problem in this.Now the problem is that i have my applictaion will talk to another application which is on another machine.Both machine are connected by NULL MODEM SERIAL RS232 cable.So i need to write and read from my COM port.So i have to desgin my program in such a way that whwenver any data comes from another machine to my port i raed it and similteanosly i can also write to it for the second application.
Hope u will help me
Deepak
|
|
|
|
|
hi all,
i want to do https authentication programatically , i mean without the use of browser.
is there any way to do.
any libraries.
TIA
regards
tarun
|
|
|
|
|
Try the OpenSSL library (www.openssl.org[^]). It's complex, but so is SSL. It's probably the best SSL library around.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
thanks a lot for pointer
-regards
tarun
|
|
|
|
|
You're welcome
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi There
i have a list control which contains a list of numbers
i want to loop through each item and add them to a CString
so my CSTring would = "45466,4554,767567,88674,34535,66654,66565"
ive got as far as loop through the List Ctrl but i dont know how to
create the string, by appending each item
any1 ne ideas
thanks
simon
void CSelectStudents::CreateGroupList(void)
{
for (int f=0; f< m_studentlist.GetItemCount(); f++)
{
CString stud_id = m_studentlist.GetItemText(f,3);
}
}
|
|
|
|
|
you may use somthing like this
CString stud_id +=
|
|
|
|
|
si_69 wrote:
void CSelectStudents::CreateGroupList(void)
{
CString stud_id;
stud_id.Empty();
for (int f=0; f< m_studentlist.GetItemCount(); f++)
{
stud_id += m_studentlist.GetItemText(f,3);
}
}
~RaGE();
|
|
|
|
|
Like the previous post said.. use +=
You have to declare your string before the loop..
void CSelectStudents::CreateGroupList(void)
{
CString stud_id;
for (int f=0; f< m_studentlist.GetItemCount(); f++)
{
stud_id += m_studentlist.GetItemText(f,3);
}
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I need to store data(large amount of classes(all classes derived from 1). The program must work under clear Windows(without Ofiice etc.). I can only read previous data and add data. How can i realize it?
//Sorry for my English
|
|
|
|
|
The answer is that it depends on what data that you need to store (it's much simpler if it's just Plain Old Data), and what platform you are using. Under .NET serialization support is provided, at least to a certain extent.
A good serialization primer: C++ FAQ Lite: Serialization[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thx. for example. I've already thought about it. But if i need to get only a part of data. Is it possible in Serialization?
I use VC++6.0.
|
|
|
|
|
Svin wrote:
But if i need to get only a part of data. Is it possible in Serialization?
It is possible, all you have to do is only serialize the members which you require when you need to reload the objects.
Sometimes you may not even need to reload the data into an object of the same type, you might just load into a temporary structure. This also has the benefit of keeping messy serialization code away from your original classes and prevents problems of public members or lots of messy pointers to functions.
There of heaps of good examples out there on how to start serialization, my advice is to think simple, (your own format, preferrably text based to make debugging easy) which is as simple to read and write as possible - but try to allow for room to replace a simple system with something more complex if your project is going to grow (maybe XML?)
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Now I meet a problem
I don't know how to specify a series of data for a char array.
char A[5];
Its initial value is a value of "abcd"
How to solve this problem?
Thank you in advance!
|
|
|
|
|
char A[5]
sprintf(A,"abcd");
Now I bring to mind.
|
|
|
|
|
or you can always do:
<code>
char A[] = _T("ABCD")
</code>
If you know the contents on declaration.This way you don't need to worry about the string fitting the array size. Its automatically sized for you.
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Your way is better than mine.
Can you tell me what is the meaning of "_T"?
|
|
|
|
|
If you ever decide to convert your program to support UNICODE characters, e.g. multilanguage support, there are a few simple but worthwhile techniques that you can do in your program to achieve this:
- The _T macro converts your literal string to unicode, if enabled. This is also the same as the TEXT() macro.
- Instead of char, declare your characters as TCHAR. When compiling a UNICODE program, the character will be treated as a double-byte character, instead of the usual single byte set.
- Most of the C++ string manipulation routines have a UNICODE version. eg. strcpy will only work on ANSI encoded charaters. _tcscpy does exactly the same thing but also uses the correct function if compiling in UNICODE mode.
if you are just starting off with C++, you don't need to stress yourself with this right now, but be aware of them because sooner or later you are bound to meet them again.
Have a look at a few of CodeProjects articles on unicode programming if you are interested:
Sorry to over-complicate things
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
Your instructions are very good.
You let me know well about it.
Thank you!
|
|
|
|
|
Just two additional comments:
a) for the unicode support, you would have to make the declaration TCHAR instead of char.
b) TCHAR x[] = _T("abcd") initializes 5 characters (including the terminating 0) If you don't want that, you need to use TCHAR x[] = { 'a', 'b', 'c', 'd' };
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
How to enumerate a connection as Active as soon as it starts dialing? under windows 2000/XP/NT?
Only under win 98 RasEnumConnections function returns handle when the system starts dialing?
Please help, very important
|
|
|
|
|
how to display the date retrieve from mysql database and then display in the plain text box after this how to get back the date in the text box and convert to date type so that i can increase the year
|
|
|
|
|
If you are using MFC, Have a look at COleDateTime and COleDateTimeSpan.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|