Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. error C2022: '65279' : too big for character

error C2022: '65279' : too big for character

Scheduled Pinned Locked Moved C / C++ / MFC
comxmlhelpquestionannouncement
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    monsieur_jj
    wrote on last edited by
    #1

    Hi all, I am getting an error C2022: '65279' : too big for character at the line in bold below, What should I change here? This code works if I use wsprintfW and wszBuffer is WCHAR however I need this for multibyte and must use "_T" not "L" Any advise? Thanks, Jayjay

    if( pRegInfo->uTaskRegID == 0 )
    {
    GUID AppGUID, TaskGUID;
    ::CoCreateGuid(&AppGUID);
    ::CoCreateGuid(&TaskGUID);
    WCHAR wszGUID[50], wszTaskGUID[50];
    ::StringFromGUID2(AppGUID, wszGUID, 50);
    ::StringFromGUID2(TaskGUID, wszTaskGUID, 50);
    TCHAR wszBuffer[1025] = { 0 };
    ::wsprintf(wszBuffer,
    _T("\xfeff<?xml version=\"1.0\" encoding=\"UTF-16\" ?>\n")
    _T("<applications xmlns=\"http://schemas.microsoft.com/windows/cpltasks/v1\\" xmlns:sh=\"http://schemas.microsoft.com/windows/tasks/v1\\">")
    _T("<application id=\"%s\">")
    _T("<sh:task id=\"%s\" needsElevation=\"%s\">")
    #ifdef _UNICODE
    L"sh:name@%s,-%ld</sh:name>"
    L"sh:keywords@%s,-%ld</sh:keywords>"
    L"sh:command%%systemroot%%\\system32\\control.exe /name %s</sh:command>"
    #else
    _T("sh:name@%hs,-%ld</sh:name>")
    _T("sh:keywords@%hs,-%ld</sh:keywords>")
    _T("sh:command%%systemroot%%\\system32\\control.exe /name %hs</sh:command>")
    #endif // _UNICODE
    _T("</sh:task>")
    _T("<category id=\"%ld\">")
    _T("<sh:task idref=\"%s\"/>")
    _T("</category>")
    _T("</application>")
    _T("</applications>"),
    wszGUID,
    wszTaskGUID,
    pRegInfo->dwRunLevel == 0 ? _T("false") : _T("true"),
    szDllName, Info.uTaskRes,
    szDllName, Info.uKeywordsRes,
    Info.pstrCanonicalName,
    pRegInfo->dwCategory,
    wszTaskGUID);
    ::wsprintf(szGUID, _T("%ws"), wszGUID);
    ::lstrcpy(szTaskFileUrl, szDllFile);
    ::wsprintf(_FindLastOf(szTaskFileUrl, '.'), _T("_cpl%d.xml"), pRegInfo->iIndex + 1);
    if( bRegister ) {
    HANDLE hFile = ::CreateFile(szTaskFileUrl, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
    if(

    S 1 Reply Last reply
    0
    • M monsieur_jj

      Hi all, I am getting an error C2022: '65279' : too big for character at the line in bold below, What should I change here? This code works if I use wsprintfW and wszBuffer is WCHAR however I need this for multibyte and must use "_T" not "L" Any advise? Thanks, Jayjay

      if( pRegInfo->uTaskRegID == 0 )
      {
      GUID AppGUID, TaskGUID;
      ::CoCreateGuid(&AppGUID);
      ::CoCreateGuid(&TaskGUID);
      WCHAR wszGUID[50], wszTaskGUID[50];
      ::StringFromGUID2(AppGUID, wszGUID, 50);
      ::StringFromGUID2(TaskGUID, wszTaskGUID, 50);
      TCHAR wszBuffer[1025] = { 0 };
      ::wsprintf(wszBuffer,
      _T("\xfeff<?xml version=\"1.0\" encoding=\"UTF-16\" ?>\n")
      _T("<applications xmlns=\"http://schemas.microsoft.com/windows/cpltasks/v1\\" xmlns:sh=\"http://schemas.microsoft.com/windows/tasks/v1\\">")
      _T("<application id=\"%s\">")
      _T("<sh:task id=\"%s\" needsElevation=\"%s\">")
      #ifdef _UNICODE
      L"sh:name@%s,-%ld</sh:name>"
      L"sh:keywords@%s,-%ld</sh:keywords>"
      L"sh:command%%systemroot%%\\system32\\control.exe /name %s</sh:command>"
      #else
      _T("sh:name@%hs,-%ld</sh:name>")
      _T("sh:keywords@%hs,-%ld</sh:keywords>")
      _T("sh:command%%systemroot%%\\system32\\control.exe /name %hs</sh:command>")
      #endif // _UNICODE
      _T("</sh:task>")
      _T("<category id=\"%ld\">")
      _T("<sh:task idref=\"%s\"/>")
      _T("</category>")
      _T("</application>")
      _T("</applications>"),
      wszGUID,
      wszTaskGUID,
      pRegInfo->dwRunLevel == 0 ? _T("false") : _T("true"),
      szDllName, Info.uTaskRes,
      szDllName, Info.uKeywordsRes,
      Info.pstrCanonicalName,
      pRegInfo->dwCategory,
      wszTaskGUID);
      ::wsprintf(szGUID, _T("%ws"), wszGUID);
      ::lstrcpy(szTaskFileUrl, szDllFile);
      ::wsprintf(_FindLastOf(szTaskFileUrl, '.'), _T("_cpl%d.xml"), pRegInfo->iIndex + 1);
      if( bRegister ) {
      HANDLE hFile = ::CreateFile(szTaskFileUrl, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
      if(

      S Offline
      S Offline
      Saurabh Garg
      wrote on last edited by
      #2

      I don't see a bold line. Error C2022 in the documentation says, "The octal number following a backslash (\) in a character or string constant is too big to represent a character". So I am guess that you are trying to assign a number greater than 255 for a char variable. -Saurabh

      M 1 Reply Last reply
      0
      • S Saurabh Garg

        I don't see a bold line. Error C2022 in the documentation says, "The octal number following a backslash (\) in a character or string constant is too big to represent a character". So I am guess that you are trying to assign a number greater than 255 for a char variable. -Saurabh

        M Offline
        M Offline
        monsieur_jj
        wrote on last edited by
        #3

        Hi Saurabh, It is this line

        _T("\xfeff<?xml version=\"1.0\" encoding=\"UTF-16\" ?>\n")

        Thanks, Jayjay

        S 1 Reply Last reply
        0
        • M monsieur_jj

          Hi Saurabh, It is this line

          _T("\xfeff<?xml version=\"1.0\" encoding=\"UTF-16\" ?>\n")

          Thanks, Jayjay

          S Offline
          S Offline
          Saurabh Garg
          wrote on last edited by
          #4

          The first character is \xfeff which is 65279. This value cannot be stored in a char variable. I think you can split it into two characters for ANSI chars (\xfe\xff) and single char for wide-chars. -Saurabh

          B 1 Reply Last reply
          0
          • S Saurabh Garg

            The first character is \xfeff which is 65279. This value cannot be stored in a char variable. I think you can split it into two characters for ANSI chars (\xfe\xff) and single char for wide-chars. -Saurabh

            B Offline
            B Offline
            Bram van Kampen
            wrote on last edited by
            #5

            Saurabh.Garg wrote:

            The first character is \xfeff which is 65279. This value cannot be stored in a char variable. I think you can split it into two characters for ANSI chars (\xfe\xff) and single char for wide-chars.

            But: Keep in mind how values are stored.On an Intel Machine: \xfeff should be reversed when broken up as: \xff\xfe. :)

            Bram van Kampen

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups