output thru serial port

hi
i have a small problem which i m not able to solve. ive made a form in PhAb and wat i intend to do is that when i press a button “#041701” goes out of my serial port.

i used the simple code for writing on serial port as:

int main(void)
{
int fd;
char buffer[]={"#041701"};

  fd=open("/dev/ser1", O_RDWR);
  write(fd, buffer, sizeof (buffer))
  close(fd);
  return 0;

}

but i did not get the desired output. when i used Visual Basic on windows platfom i had to send “#041701” & chr$(13). here chr$(13) is used for enter key. can anyone tell me how do i achieve this.
thank you

Can you explain what you are getting and what you are expecting.

Note that since buffer is a string and nul terminated, the null will be sent as well.

hi i am actually doin a project in which i have to give command to an adam module thro serial port. the string “#041701” is a particular code for that module.

i tried to use the above prog and send to hypertreminal(windows) on other PC. when i sent alphabets as string nothing appeared on hyperterminal window. when i sent 0s and 1s garbage values appeared. i wish to transmit the entire string when i press carriage return. cud u plz help me in this

thanks

serial port settings (baud rates different for example)

how do u change the serial port settings. plz tell the necessary changes required in the prog