OK, I was erring about one very important detail: the second argument to system({expr},{input})
isn't treated as shell input, it is sent as stdin. So you would do something like:
:let stdin = join(getline(1,'$'), "\n")
:let a = system('C:/main.exe',stdin)
Almost all examples of system(..)
use and warn about shell escaping, but that is for the {expr}
argument (and this escaping is a much smaller problem if {expr}
is not a dynamic string).