Answer to Question stdio-outf-2

#include <cstdio>
using namespace std;

int main(int argc, char** argv)
{
  if(argc == 2)
  {
    FILE* f = fopen(argv[1], "w");

    if(f != NULL) 
    {
      fprintf(f, "Robin hood and his merry men");
      fclose(f);
      return 0;
    }
    else 
    {
      printf("File %s cannot be opened for writing\n", argv[1]);
      return 1;
    }
  }
  else
  {
    printf("No file argument provided\n");
    return 1;
  }
}