Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!stanford.edu!agate!usenet.ins.cwru.edu!tut.cis.ohio-state.edu!uoft02.utoledo.edu!desire.wright.edu!jmatthews From: jmatthews@desire.wright.edu Newsgroups: comp.sys.mac.programmer Subject: Re: SerialDriver programming Message-ID: <1991Apr9.230956.3159@desire.wright.edu> Date: 10 Apr 91 04:09:56 GMT References: <1991Apr9.002744.28880@wpi.WPI.EDU> Organization: University Computing Services, Wright State University Lines: 43 In article <1991Apr9.002744.28880@wpi.WPI.EDU>, nuk@wpi.WPI.ED (Jacob W Anderson) writes: > I have been trying to program my serial port on a MacSE with 128k ROMs using > a Hayes compatible modem, but have found that the protocol used in the > following program does not work properly. In fact, it does not work at all > it does not generate any run-time errors, but rather does nothing that it > should (like dialing). > Please, if you have any idea what I am doing wrong, please tell me. I possible > please tell me in 'C' for I am using both Think Pascal and Think C, but the > final project is to be in 'C'. Thanks in adavance. > > please E-mail. > nuk@wpi.wpi.edu > > ================================================ > > [...] > > {this procedure sends data to the modem} > procedure Send (Data: Str255); > var > Count: LongInt; > begin > Count := LongInt(Length(Data)); > writeln('Sending ', Data, ' &', count, 'bytes'); > Buffer := @Data; > Error := FSWrite(PortOut, count, Buffer); > DoError; > end; > > [...] One problem lies in passing FSWrite a pointer to the first byte in a Pascal string. This byte is the string's length. Try Buffer:= pointer(ord(@data)+1) Hope this helps, John o----------------------------------------------------------------------------o | John B. Matthews, jmatthews@desire.wright.edu, am103@cleveland.freenet.edu | | "Say...what's a mountain goat doing way up here in a cloud bank?" - Larson | o----------------------------------------------------------------------------o