RE: [Dev-C++] passing the content of a string to a variable from
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@at...> - 2003-04-09 11:04:17
|
> -----Original Message-----
> From: Per Westermark [mailto:pw...@ia...]
> Sent: Wednesday, April 09, 2003 10:02 AM
> To: Ioannis Vranos
> Cc: Dev-C++ Mailing List
> Subject: RE: [Dev-C++] passing the content of a string to a
> variable from
>
>
> See below.
>
> /Per W
>
> On Wed, 9 Apr 2003, Ioannis Vranos wrote:
>
> > > -----Original Message-----
> > > From: dev...@li...
> > > [mailto:dev...@li...] On Behalf
> > > Of jose isaias cabrera
> > > Sent: Wednesday, April 09, 2003 4:52 AM
> > > To: dev...@li...
> > > Subject: [Dev-C++] passing the content of a string to a
> variable from
> > >
> > >
> > >
> > > Greetings O SmartOnes!
> > >
> > > I have the following c code:
> > >
> > > char FileContent(char *file)
>
> // Need to return a pointer to text, not just a single character.
> char* FileContent(char *file)
Just for accuracy, Ioannis Vranos had not written the above.
>
> > > {
> > > char fcontent(3000);
>
> // Array size should be in []
> // You may never return address of a variable declared on stack.
> // As soon as the FileContent() returns, the fcontent buffer would
> // be deleted unless it's declared static, which will store
> // fcontent as a global variable but only available within name
> // space of FileContent().
> static char fcontent[3000];
The same apply for your comments here.
:)
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net
Anti-racism movement: http://www.positive-youthfoundation.org
Iraq Peace Pledge: http://www.peacepledge.org
|