Easiest way to use FTDI in c++ ??

Hi all. I have FTDI chip which is seen as /dev/ttyUSB0 Im connecting with it using putty with no problems but Id like to put all of this what is putten by my chip into my own application (using Qt4 and already looking nice).

Now Im getting ewerything by system('cat /dev/ttyUSB0') - but its not cool. I know that there must be something especially for it. Maybe some kind of lib or sth.

ps. it works at 115200

Reply to
witekadamus
Loading thread data ...

Why not use the "open" command like ....

fdPort = open( SERIAL_PORT, O_RDWR | O_NOCTTY ); if (fdPort < 0) { printf("\nError opening %s - %d %s\n", SERIAL_PORT, errno, strerror(errno)); return -1; } //Save old attributes of the port tcgetattr( fdPort, &oldAttr );

//Configure port with new attributes bzero( &newAttr, sizeof( newAttr )); newAttr.c_cflag = BAUD_RATE | CS8 | CREAD | CLOCAL ; newAttr.c_iflag = IGNPAR; newAttr.c_oflag = 0; //non-cononical mode newAttr.c_lflag = 0; //Unused inter ch timer newAttr.c_cc[ VTIME ] = 0; //No blocking for read chars newAttr.c_cc[ VMIN ] = 0;

tcflush( fdPort, TCIFLUSH ); tcsetattr( fdPort, TCSANOW, &newAttr );

Reply to
Janaka

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.