All pastes #13058 Raw Edit

Anonymous

public text v1 · immutable
#13058 ·published 2005-05-31 23:05 UTC
rendered paste body
#include <stdio.h>
#include <termios.h>
#include <fcntl.h>

int main (int argc, char * * argv) {
  if (argc < 2) {
    printf("Usage: setbaud port\n");
    return 1;
    }
  int fd = open(argv[1], O_RDWR);
  if (fd < 0) {
    printf("Couldn't open %s\n", argv[1]);
    }
  
  struct termios tr;

  tcgetattr(fd, &tr);
  cfsetispeed(&tr, B4800);
  cfsetospeed(&tr, B4800);
  tcflush(fd, TCIFLUSH);
  tcsetattr(fd, TCSANOW, &tr);
  }