Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uwm.edu!csd4.csd.uwm.edu!markh From: markh@csd4.csd.uwm.edu (Mark William Hopkins) Newsgroups: comp.lang.c Subject: Re: Sending struct through DGRAM socket Message-ID: <11138@uwm.edu> Date: 18 Apr 91 16:16:32 GMT References: <14918@helios.TAMU.EDU> Sender: news@uwm.edu Distribution: na Organization: University of Wisconsin - Milwaukee Lines: 13 In article <14918@helios.TAMU.EDU> greg@carnivore.tamu.edu (Greg Economides) writes: >Is there a quick/clean way to translate a struct into a character stream >(and then a way to get the struct back) so that it can be sent using these >functions? Structs are formatted in a machine-dependent and compiler-dependent way. You absolutely need to set up routines to break apart and form the struct by hand. You know, like: sprintf(Buf, "%5.3f:%5.3f:%5.3f\n", A->X, A->Y, A->Z); SendBytes(Buf); and whatever the corresponding sscanf and "RecvBytes" statements are.