M
Mike Mimic
Hi!
Is it possible to write this (and that it will work):
char *buffer = ... // some array of chars terminated by \0 (allocated
// with new and filled somewhere else)
int t = ... // some value - how much to delete at the begining
char *rest = new char[strlen(buffer) - t + 1];
strcpy(rest, buffer + t);
delete[] buffer;
buffer = rest;
in this way:
char *buffer = ... // some array of chars terminated by \0 (allocated
// with new and filled somewhere else)
int t = ... // some value - how much to delete at the begining
strcpy(buffer, buffer + t);
(This is only a code simmilar to that in my program but the idea is
here, t is always smaller than length.)
Mike
Is it possible to write this (and that it will work):
char *buffer = ... // some array of chars terminated by \0 (allocated
// with new and filled somewhere else)
int t = ... // some value - how much to delete at the begining
char *rest = new char[strlen(buffer) - t + 1];
strcpy(rest, buffer + t);
delete[] buffer;
buffer = rest;
in this way:
char *buffer = ... // some array of chars terminated by \0 (allocated
// with new and filled somewhere else)
int t = ... // some value - how much to delete at the begining
strcpy(buffer, buffer + t);
(This is only a code simmilar to that in my program but the idea is
here, t is always smaller than length.)
Mike