W
W
wefhuieu2020-07-08 17:21:33
C++ / C#
wefhuieu, 2020-07-08 17:21:33

How to get data from the command line and process it?

Hello everyone, tell me how to get data from the command line and process it

int main(int argc, char *argv[])
{
    try
    {
    for (int i = 0; i < argc; i++)
    {
      if (argv[i] = "-conv_to_doc")
      {
        if (argv[i+1] = "-i")
        {
          wstring fl_nm = argv[i + 2];

          RunSamples(argv[i], fl_nm);
        }
      }
    }


Here I am getting data and sending it to RunSamples

But I get an argv error - there is no suitable constructor to convert from char * to wstring

int RunSamples(string conv_name, wstring file_name)


Tell me pliz, if there is another easier way to get data from the command line, please help)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wefhuieu, 2020-07-08
@wefhuieu

Problem solved, reply
if (wcscmp(argv[count], L"conv_type_to_doc") == 0)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question