search

Home  >  Q&A  >  body text

c++ - C语言中通过系统调用生成的文件存放在哪里?

怪我咯怪我咯2773 days ago509

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-17 14:39:50

    sprintf(cmd, "echo '%s %s' >> reports.log", now());
    There are obviously two

    in the %s format string, but there is only one now() in the following parameter (didn’t your compiler give a warning?). In sprintf(), it is thought that you passed in two strings. When it reads the parameter that does not exist, an access violation occurs. I saw that you still have a comment variable that is not used. Does this mean:

    sprintf(cmd, "echo '%s %s' >> reports.log", now(), comment);

    As for the created file, it is right next to the compiled EXE file, not necessarily in the source code directory.
    Regarding the 系统调用 in the question: My first reaction was open(), and then CreateFile(). This is considered a command line, and it cannot be called 系统调用.

    reply
    0
  • Cancelreply