P
P
Pavel Kazutin2019-07-18 11:30:07
C++ / C#
Pavel Kazutin, 2019-07-18 11:30:07

Why doesn't CharToOemW convert all characters?

There is a line "╔════╤══════════════════════════════════␐═ ═══════════════════════╗". From it is translated into char only ══════════════════════". The CharToOem function receives a complete string. What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel Kazutin, 2020-11-28
@ktsin

The problem was really with the machine.

M
Mercury13, 2019-07-18
@Mercury13

And will this work?

inline const char* wtc(const WCHAR *from)
{
  //Используется буффер -- статическая переменная
  static char buf[1024] = { 0 };
  size_t nChars = std::min<size_t>(wcslen(from), 1024 - 1);
  if (!CharToOemBuffW(from, buf, nChars)) {
    cout << GetLastError();
    exit(-1);
  }
  buf[nChars] = 0;
  return buf;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question