Code:
void input(char *s, char *n)
{
	char *ptr;
	int c;
	
	ptr = s;
	*n = *ptr = '\0';
	do {
		c = getchar();
		switch(c) {
			case '\010':
				if(ptr > s)
					--ptr;
				break;
			case '\030':
				ptr = s;
				break;
			case '\n':
				break;
			case ' ':
				ptr = n;
				break;
			default:
				if(c >= ' ')
					*ptr++ = c;
			}
		*ptr = '\0';
	} while(c != '\n' && ptr < s + BUFFSZ);
}
this is the function i wrote to get input from the user. when i compiled it with gcc and ran it with bash it wrote the first characters to s and everything after the last space to n. when i compiled it with mingw and ran it with cmd it kept writing what was in the buffer after each space to s every time it was called. so if i typed in 3 "characters like this" in bash it would make s equal to "characters" and n equal to "this", whereas in cmd it writes "characters" to s, then "like" to s when it's next called, then "this" to s when it's next called.

does anybody know how i could rewrite this function in a way that cmd supports?