I tried programming a file writer, but when i try to write to a file with something that has multiple words it will suddenly create files.
My code
#include <fstream>
#include <iostream>
#include <unistd.h>
int main(int argc, char *argv[]) {
  char cwd[256];
  while (true) {
    getcwd(cwd, 256);
    std::string cwd_s = (std::string)cwd;
    std::string Input;
    std::cout << cwd_s << "> ";
    std::cin >> Input;
    std::ofstream file(Input);
    std::cout << "cmd /";
    std::cin >> Input;
    file << Input;
  };
  for (int i; i < argc; i++) {
    std::cout << argv[i] << '\n';
  };
  return 0;
}
I expected to get this:
C:\Users\code> File.txt
cmd /hello world!
File.txt
hello world!
But it only had "hello", it created another file named world!
I have tried changing the code, but to no avail.
 
     
    