Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uwm.edu!bionet!agate!ucbvax!ucsd!mvb.saic.com!eafbvax!eafbtsws!elston From: elston@edwards-saftd-2.af.mil Newsgroups: comp.unix.programmer Subject: Recasting to a pointer to a function. Message-ID: <1991Mar14.155825.31@edwards-saftd-2.af.mil> Date: 14 Mar 91 23:58:25 GMT Organization: T&E Mission Simulator - Edwards AFB, CA Lines: 33 We are trying to assign to a pointer to a function the value stored in a long (which on our system is the same size.) We would like to recast the long into a function pointer. Is there any method for doing this in 'C'? We tried the following int (*dbp)(); long lvar; . . . dbp = (()*) lvar; and it failed to compile. Is there any method for doing this recast? The other option we have tried is (long) dbp = lvar; but when we run this we get a core dump (at the minimum). We are not sure if this is due to improper handling of the recast (should not be) or ????? Does anyone have any ideas? Thanks in advance, Mark -- ############################################################################## # A mind is a terrible thing to waste - elston@edwards-saftd-2.af.mil # # Thank goodness mine's all used up. # # # # If the author has expressed any opinions here they are purely # # accidental and should be ignored. # ##############################################################################