Results 1 to 5 of 5

Thread: char[] ... overflow ?

  1. #1
    DaoK
    Guest

    char[] ... overflow ?

    I want to have like 2 000 000 place for my char length but it do not let me ? How can I solve that to have a lots of place ?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You want a 2 million character string?

    It probably won't let you allocate it on the stack since you only get 1mb by default (from Windows). You can tweak it up with linker options, but it's probably best to use new[] and allocate it on the heap as well.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    DaoK
    Guest
    You can tweak it up with linker options, but it's probably best to use new[] and allocate it on the heap as well.
    ok... I do not see any stuff in my book about that. I want to put charactere from a file in a char[]... after I want to compare and replace and add... Do you have any idea with a little piece of code please?

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You want to load an entire file into memory? You're probably best off looking into rope classes... Do a search on Google and you might find something

    For allocation:
    Code:
    char *buf = new char[2000000];
    ...or similar
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    DaoK
    Guest
    thx you my friend!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width