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. Maximum length of string??

Maximum length of string??

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 Posts 2 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.
  • X Offline
    X Offline
    xxhimanshu
    wrote on last edited by
    #1

    :confused::confused:Hi all, can anyone tell me what is the maximum number of bytes and characters i can store using a CString variable..I need to store huge data something in MB's in some string type variable and it fails..is there any way to store any size of characters or any no of bytes in a cstring by customizing it..Please help me..I need it urgently?? Hope this is not a big problem for most of u out there?? Thanks a lot in advance.. Regards, Himanshu

    M 1 Reply Last reply
    0
    • X xxhimanshu

      :confused::confused:Hi all, can anyone tell me what is the maximum number of bytes and characters i can store using a CString variable..I need to store huge data something in MB's in some string type variable and it fails..is there any way to store any size of characters or any no of bytes in a cstring by customizing it..Please help me..I need it urgently?? Hope this is not a big problem for most of u out there?? Thanks a lot in advance.. Regards, Himanshu

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      xxhimanshu wrote: store huge data something in MB's in some string type variable and it fails Fails how? CString uses the heap so the theoretical limit on the string size is 2GB or your total available virtual memory. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Actual sign at the laundromat I go to: "No tinting or dying."

      X 1 Reply Last reply
      0
      • M Michael Dunn

        xxhimanshu wrote: store huge data something in MB's in some string type variable and it fails Fails how? CString uses the heap so the theoretical limit on the string size is 2GB or your total available virtual memory. --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Actual sign at the laundromat I go to: "No tinting or dying."

        X Offline
        X Offline
        xxhimanshu
        wrote on last edited by
        #3

        :confused::confused:Hi, Thanks for your message. I am just trying to store a encoded XMl file data into the string..so that I do not need to decode it any time..and make it physically available to the user..hence I need to store the data into a string. But after a limit it stops appending the data to the string, I hope there cannot be any NULL into a XML file. When i try to decode it, the file is decoded successfully and hence it is in proper XML format..but when i try to store the same data into string it just stops at a point..here is the piece of code i am using.. CString S; CString XML; XML=S; CFile inFile; BYTE con[65535]; CFile outFile; if(!inFile.Open(inFilePath,CFile::modeRead|CFile::shareDenyNone)) return "Error"; if(!outFile.Open(outFilePath,CFile::modeCreate|CFile::modeWrite)) return false; CArchive ar(&inFile,CArchive::load); BYTE Result[57+1]; while(ar.ReadString(S)) { char Len=Decode(Result,S); XML+=Result; // MessageBox(NULL,XML,"XML",MB_OK); outFile.Write(Result, Len); } return XML; Please help..Thanks a lot in advance..My data in XML is around 1 MB..the file size id 1.2 MB nearly.. Regards Himanshu

        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