delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/09/18:13:18

From: Steven Watson <steven DOT watson AT dtn DOT ntl DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: pointers
Date: Tue, 07 Dec 1999 09:17:11 +0000
Organization: Netscape Online member
Lines: 36
Message-ID: <384CD097.B95E1019@dtn.ntl.com>
NNTP-Posting-Host: p1-harc1-kirklees1.tch.dtn.ntl.com
Mime-Version: 1.0
X-Trace: nclient3-gui.server.dtn.ntl.com 944780146 29809 194.168.244.1 (9 Dec 1999 22:55:46 GMT)
X-Complaints-To: abuse AT net DOT ntl DOT com
NNTP-Posting-Date: 9 Dec 1999 22:55:46 GMT
X-Mailer: Mozilla 4.6 [en-gb]C-CCK-MCD NetscapeOnline.co.uk (Win95; I)
X-Accept-Language: en-GB,en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi Everyone

Is it possible someone can tell me how this code can be written to
change the pointer sent to it
in pow! using a VAR it will make a copy so the value can be changed but
I am unable to figure it out in C?

int  main(void)
char *string;
  file_reads(1,5,&string);
    printf("%s \n",string);
return 0;
}
function from include file:

void file_reads(int handle,int length,char *dummy)
{


     if ((dummy=(char *)malloc(length+1))==NULL){
        puts("Error code here");
        exit(1);
     }


if((fread(dummy,sizeof(char),length,filehandle[handle]))!=length){
            puts("Put error code here");
            exit(1);
         }
                *(dummy+length)=0x00;
               printf("%s\n",dummy);//it prints here fine as expected.
return;
}

thanks in advance
Steven Watson

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019