[ create a new paste ] login | about

Link: http://codepad.org/zAtUYMjL    [ raw code | output | fork ]

C++, pasted on Apr 19:
#include <iostream>
using namespace std;

char * strcopy(char * str, char * cmp)
{
	char * ptr = str;
	while(*str && *cmp)
		*str++ = *cmp++;
	*str = 0;
	return ptr;
}
 
char * remBegSpaces(char * str)
{
    while(str + 1 && *str == ' ')
        strcopy(str,str + 1);
    return str;
}

int main()
{
    char str[] = "          test";
    cout<<"Input string : "<<str<<endl;
    cout<<"Move spaces in begin : "<<strcopy(str,remBegSpaces(str))<<endl;
    system("pause");
    return 0;
}


Output:
1
2
3
4
Input string :           test
Move spaces in begin : test

Disallowed system call: SYS_fork


Create a new paste based on this one


Comments: