When using the constructor from the TTYStream class to open a TTY serial port.....
TTYStream (const char *filename)
..... it seems that if a non-existing filename/TTY port name is used, my program causes a segmentation fault when the object is created. Now what I'm wondering is if there's a way to prevent this from happening when an illegal filename is used. Is it possible to use exceptions in this case? (There is very little documentation on how to use exceptions). Is there something else about the class that I don't know about?
This program I am running is a real-time embedded system, and so my program cannot crash, but must die gracefully when an illegal filename is used.
I am using Common C++ 1.6.2, running under Solaris 2.8, with GCC compiler version 2.95.5.
Any help would be greatly appreciated!
Marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When using the constructor from the TTYStream class to open a TTY serial port.....
TTYStream (const char *filename)
..... it seems that if a non-existing filename/TTY port name is used, my program causes a segmentation fault when the object is created. Now what I'm wondering is if there's a way to prevent this from happening when an illegal filename is used. Is it possible to use exceptions in this case? (There is very little documentation on how to use exceptions). Is there something else about the class that I don't know about?
This program I am running is a real-time embedded system, and so my program cannot crash, but must die gracefully when an illegal filename is used.
I am using Common C++ 1.6.2, running under Solaris 2.8, with GCC compiler version 2.95.5.
Any help would be greatly appreciated!
Marc
??? version 1.6.2 ??
Can you post the code ??
Here's some code to describe what I mean:
-------------------------------------------
class Door : public TTYSession
{
...
public:
Door(char *TTYname);
...
}
Door::Door(char *TTYname) : TTYSession(TTYname)
Door tempDoor;
tempDoor = new Door("/dev/sts/ttyn11");
// crashes here, when creating Door object
If the TTY filename used is not on the system --> segmentation fault.