开发者

xdrmem_create segmentation fault

开发者 https://www.devze.com 2023-01-29 23:00 出处:网络
#define BS 1000 XDR *xdrs; char buf1[BS]; xdrmem_create(xdrs,buf1,BS,XDR_ENCODE); I followed what the text book said but whenever I ran my program, it has segmentation fault.
#define BS 1000
XDR *xdrs;
char buf1[BS];
xdrmem_create(xdrs,buf1,BS,XDR_ENCODE);

I followed what the text book said but whenever I ran my program, it has segmentation fault. I开发者_StackOverflow think there is problem with xdrmem_create. Has anybody here been successful when using this function?

(I'm using Ubuntu 10.10)


You didn't initialize the pointer. Fix:

XDR stream;
xdrmem_create(&stream, buf1, BS, XDR_ENCODE);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号