Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.linkpendium.com!news.linkpendium.com!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: ctypes - python2.7.3 vs python3.2.3 Date: Tue, 28 Aug 2012 21:51:05 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 21 Message-ID: References: <18eb8025-7545-4d10-9e76-2e41deaadb69@googlegroups.com> NNTP-Posting-Host: panix2.panix.com X-Trace: reader1.panix.com 1346190665 21100 166.84.1.2 (28 Aug 2012 21:51:05 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 28 Aug 2012 21:51:05 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:28023 In <18eb8025-7545-4d10-9e76-2e41deaadb69@googlegroups.com> Rolf writes: > uint32_t myfunction (char ** _mydata) > { > char mydata[16]; > strcpy(mydata, "Hello Dude!"); > *_mydata = mydata; > return 0; > } mydata is an auto variable, which goes out of scope when myfunction() exits. *_mydata ends up pointing to garbage. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"