Strings.....
Nelson Guedes Paulo Junior
npaulo@linux.ime.usp.br
Fri May 5 04:50:00 GMT 2000
Hello to everyone....
I need a really fast way to do the following:
I have a (char *) that contains am arbitrary string and have space to do
the desired operation. Now i need to left-shift the string from n
positions and fill the initial n position with space.
for example:
char *string;
string = (char *)malloc(sizeof(char)*10);
string = "Hello\0";
left_shift_string(string,2);
printf("String value:%s\n",string);
When you execute the following code, will be printed:
"String value: Hello"
Note that now we have two spaces at the beggining of the string.
The function can assume that we HAVE space to do the operation, n
will be an positive integer, must run on Windows/Dos/Unix/Linux
systems and must follow the prototype:
char *left_shift_string(char *string,int n);
Thanks....
[]'s
--
Nelson Guedes Paulo Junior
E-mail: <npaulo@linux.ime.usp.br> UIN: 2489382 (Tender AML)
HomePage: (Em eterna construção)
http://members.xoom.com/DuneKiller/index2.html
More information about the Gcc-help
mailing list