Thread: Sending Data
View Single Post
  #1   Spotlight this post!  
Unread 09-09-2003, 19:50
Raven_Writer's Avatar
Raven_Writer Raven_Writer is offline
2004 Detroit & Pittsburgh Winners
AKA: Eric Hansen
FRC #0005 (RoboCards)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Melvindale
Posts: 1,549
Raven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really niceRaven_Writer is just really nice
Send a message via ICQ to Raven_Writer Send a message via AIM to Raven_Writer Send a message via MSN to Raven_Writer Send a message via Yahoo to Raven_Writer
Sending Data

Ok, I'm almost done w/ my PBASIC Editor, and I'm just wondering...how would you send the code (in MFC)?

I've created a thread, and it doesn't have any problems.

I've been looking at how roboIDE sent the code, and if anyone can just translate these from Linux to Windows I would be set (I don't know any *nux programming):
Code:
read(fd, data, bytes);
I know the "read(...);" function reads the data from a port...but I'm not sure of the equivalent of it in Windows.

Code:
write(fd, data, bytes);
Save as "read(...);"
Code:
close(fd);
I've attempted "CloseHandle(...);", but it throws back a error.
Code:
int openSerial(char *port){
   int fd;
   struct termios tios;

   fd=open(port, O_NOCTTY | O_RDWR | O_NONBLOCK);
   if(fd<0){
     sprintf(lastError, "%s: %s\n", port, strerror(errno));
     return fd;
   }

   bzero(&tios, sizeof(termios));

   tios.c_cflag = BAUDRATE | CS8 | CREAD;
   tios.c_iflag = IGNPAR;
   tios.c_oflag=0;

   tios.c_lflag=0;

   //satisfy read immediately.
   tios.c_cc[VTIME]=0;
   tios.c_cc[VMIN]=0;

   tcflush(fd, TCIFLUSH);
   tcsetattr(fd, TCSANOW, &tios);

   return fd;
}
<<EDIT>>: I know fd stands for file directive (I think anyways).
__________________
AIM: wisprmylastbreth
EMail: nightskywriter@gmail.com
Y!: synsoflife

"ai yoru ga" -- "Love the nights"