Article View: comp.sys.ibm.pc.programmer
Article #712re: casting float addres into a character pointer
From: kevin reilly
Date: Tue, 12 Jun 1990 16:43
Date: Tue, 12 Jun 1990 16:43
15 lines
923 bytes
923 bytes
Thanks to all who submitted responses to my query on storing a float
address into a character pointer. All repondents but one suggested the
following:
charPt = (char *)&float;
Which does indeed work. QC2.5 no longer gives an error message.
One respondent I don't remember who suggested using a union, which works
and is much more elegant and useful for what I have to do:
union {
char c[2];
int number;
}
You can access the high or low bytes of an arbitrary integer by looking
at c[1] and c[0].
Once Again thanks to all who responded.
Technical Details
Message-ID:
<1931@bnlux0.bnl.gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!sharkey!bnlux0!reillyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!sharkey!bnlux0!reilly From: reilly@bnlux0.bnl.gov (kevin reilly) Newsgroups: comp.sys.ibm.pc.programmer Subject: re: casting float addres into a character pointer Keywords: float address pointer Message-ID: <1931@bnlux0.bnl.gov> Date: 12 Jun 90 16:43:00 GMT Organization: Brookhaven National Lab Lines: 16