Mail Archives: djgpp/2001/12/21/15:49:55
// There was also another thing wrong that I missed
void getstr(const char *string, char *new_string, int start_offset,
int end_offset)
{
int i=0;
int b=0;
for (i=start_offset; i<=end_offset; i++) {
// *(new_string+b)=string+i;
// this is assigning the pointers to a char array instead of chars
// It should be:
*(new_string+b)=*(string+i)
b++;
}
*(new_string+b)='\0';
return;
}
// This is untested but i think it works fine for any other newbies
// that are interested in the code
P.S. Sorry for the off-topic thread DJ.
--- Chris Amos <homie_dont_play_dat AT yahoo DOT com> wrote:
> It has to be a logic error of some kind because the code runs fine
> aside from a few warning messages...
>
>
-----------------------------------------------------------------------
>
> /* This is a memmory string cut function.
> *string = pointer to the string were cutting from
> *new_string = pointer to the memmory where the 'cut' string will
> go
> start_offset = Where we will start cutting >= 0
> end_offset = Where we will stop cutting >= start_offset
>
> */
> void getstr(const char *string, const char *new_string, int
> start_offset, int end_offset);
>
>
/**************************************************************************/
> void getstr(const char *string, const char *new_string, int
> start_offset, int end_offset)
> {
> int i=0;
> int b=0;
>
> for (i=start_offset; i<=end_offset; i++) {
> *(new_string+b)=string+i;
> b++;
> }
> *(new_string+b)='\0';
> return;
> }
>
> =====
> ~ Twisted Matrix (Founder of ULTRATECH)
>
> URL: N/A
> ICQ: 74628745
>
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for all of
> your unique holiday gifts! Buy at http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com
=====
~ Twisted Matrix aka. Christoph A. Amos ~
URL: http://qbrpg.qb45.com
ICQ: 74628745 *Not active right now
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
- Raw text -