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. What is the Maximum size of WCHAR

What is the Maximum size of WCHAR

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 5 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.
  • S Offline
    S Offline
    santhoshv84
    wrote on last edited by
    #1

    Hi Friends, I want to know the size of WCHAR. This is the code line i am using WCHAR InputText[99999]=L""; I am using this string to read a *.txt file. But if i choose a 5 mb file. I am not able to read. It is posible to increase the size

    Thanks and Regards. SANTHOSH V

    D C P D 4 Replies Last reply
    0
    • S santhoshv84

      Hi Friends, I want to know the size of WCHAR. This is the code line i am using WCHAR InputText[99999]=L""; I am using this string to read a *.txt file. But if i choose a 5 mb file. I am not able to read. It is posible to increase the size

      Thanks and Regards. SANTHOSH V

      D Offline
      D Offline
      Don Box
      wrote on last edited by
      #2

      U can set its value to the maximum positive value of int or to the available memory.

      Come online at:- jubinc@skype

      1 Reply Last reply
      0
      • S santhoshv84

        Hi Friends, I want to know the size of WCHAR. This is the code line i am using WCHAR InputText[99999]=L""; I am using this string to read a *.txt file. But if i choose a 5 mb file. I am not able to read. It is posible to increase the size

        Thanks and Regards. SANTHOSH V

        C Offline
        C Offline
        codeII
        wrote on last edited by
        #3

        WCHAR* InputText = ( WCHAR* ) HeapAlloc( GetProcessHeap( ), HEAP_GENERATE_EXCEPTIONS, 5 * 1024 * 1024 );

        1 Reply Last reply
        0
        • S santhoshv84

          Hi Friends, I want to know the size of WCHAR. This is the code line i am using WCHAR InputText[99999]=L""; I am using this string to read a *.txt file. But if i choose a 5 mb file. I am not able to read. It is posible to increase the size

          Thanks and Regards. SANTHOSH V

          P Offline
          P Offline
          Peter Weyzen
          wrote on last edited by
          #4

          Not many people read the whole file into a buffer. As we say, this solution doesn't scale. Most people read text files, line by line... only buffering what they need. If you're writing a text editor... it's a different story... and in that case you should dynamically allocate the text file buffer.

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer [SoonR Inc -- PC Power delivered to your phone](http://www.soonr.com)

          1 Reply Last reply
          0
          • S santhoshv84

            Hi Friends, I want to know the size of WCHAR. This is the code line i am using WCHAR InputText[99999]=L""; I am using this string to read a *.txt file. But if i choose a 5 mb file. I am not able to read. It is posible to increase the size

            Thanks and Regards. SANTHOSH V

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            santhoshv84 wrote:

            This is the code line i am using WCHAR InputText[99999]=L"";

            Why not use a std::wstring object instead?

            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            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