ofstream, duplicated values

  c++, char

values on the output are duplicated

CODE:

enum class status_t
    {
        _success,
    };

    const char* set_status(status_t status)
    {
       switch(status)
       {
       case status_t::_success: return xorstr_("[SUCCESS]");
       }
    }

    enum class action_t
    {
        _launch,
    };

    const char* set_action(action_t action)
    {
       switch (action)
       {
       case action_t::_launch: return xorstr_("[LAUNCH]");
       }
    
    }

    void record(const char* status, const char* action, char* message)
    {
       const char* directory = "C:log.txt";
       std::ofstream out(directory, std::ios_base::out | std::ios_base::app);
       out << status << char(0x20) << action << char(0x20) << message << 'n';
       out.close();
    }

    int main()
    {
      record(set_status(status_t::_success), set_action(action_t::_launch), "success");
    }

output: [SUCCESS] [SUCCESS] success

what can cause such an unusual problem?
I do not know what stackoverflow wants me to write here, enough to understand the problem

Source: Windows Questions C++

LEAVE A COMMENT