Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serial port programming 2

Status
Not open for further replies.

Hermit

Electrical
Oct 18, 2002
3
Hello, I would like to know how to write a programme to
send\receive files over the serial\COM port and which
programming language would be most suitable?

As of now, I'm able write a program to send and receive
characters through the port using a C++ compiler. However,
even after gathering enough info from the help files and
websites to get this far, I still couldn't find anything
on sending files. =
Anyhow, I would appreciate any info anyone can offer.

Thanks.


DH.
 
Replies continue below

Recommended for you

I suggest use the ASCII "0" character to mark the end of file.

i=0;
While (b=file[i++] < 0) {send(b); ); /*** send ***/
i=0;
while (b=receive()>0 ) ( data(i++)=b; ); /*** receive ***/
<nbucska@pcperipherals.com>
 
Right now I'm having a problem reading large files.
My program is only reading around 50k of the file. So my
question is if theres a method of reading large files into
the buffer, or am I just using the wrong commands?
 
Ok, I 'think' I solved my first file problem; however, I
still can't tell it where the EOF is located.

I'm sending the file in binary mode, therfore, what can I
send in binary over the COM that the other computer can
interpret as an EOF command?

Btw, I tried the ASCII '0' suggestion. I'm not sure if I
was doing it correctly, but it kept cutting the file short.
=
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor