Does system return a string on your mahcine? On most, it does not. system does not return whatever the program you call puts on screen. Don't mix up what the system call puts to screen with what your cout puts to screen.
size is some random value. At the moment you're lucky(?) in that it's big enough that when getcwd allocates some memory, size is big enough to hold the whole pathname, but you really shouldn't leave that to chance. Give size a value.