I have taken some socket examples and changed them to fit my needs. My code does everything correctly except some characters are missing. This is what it should be: MSH|^~\&|BEMRX||PYXISRX||200701031628||^~\&^RDE||P|2.3| this is what I get: SH|^~\&|BEMRX||PYXISRX||200701031624||^~\&^RDE||P|2.3| So it cuts off the first letter. Here is my code Client Code:
It has to be the infile.read() but how do I move the read back?
Thanks, Tom [ January 08, 2007: Message edited by: Tom Henricksen ]
Originally posted by Tom Henricksen: It has to be the infile.read() but how do I move the read back?
Move the what back now? infile.read() reads a single character, then the next line reads until EOL, so it is the cause of your problem. The correct way to read a line from a file would look like your server code: