Logo Search packages:      
Sourcecode: libserial version File versions  Download package

SerialStreamBuf* LibSerial::SerialStreamBuf::open ( const std::string  filename,
std::ios_base::openmode  mode = std::ios_base::in|std::ios_base::out 
)

If is_open() != false, returns a null pointer. Otherwise, initializes the streambuf as required. It then opens a file, if possible, whose name is given as the string filename using the system call std::open(filename.c_str(), flags). The value of parameter flags is obtained from the value of the parameter mode. At present, only ios_base::in, ios_base::out, and (ios_base::in|ios_baseout) make sense for a serial port and hence all other settings result in the call to fail. The value of flags is obtained as:

flags = u_flags | O_NOCTTY

where u_flags is obtained from the following table depending on the value of the parameter mode:

in out u_flags
+ O_RDONLY
+ O_WRONLY
+ + O_RDWR

Returns:
If the open() system call succeeds the method returns this. If the call fails, then it returns a null pointer.

Referenced by LibSerial::SerialStream::Open().


Generated by  Doxygen 1.6.0   Back to index