|
-
May 12th, 2002, 03:46 PM
#1
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 ?
-
May 12th, 2002, 03:54 PM
#2
Monday Morning Lunatic
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
-
May 12th, 2002, 04:23 PM
#3
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?
-
May 12th, 2002, 04:27 PM
#4
Monday Morning Lunatic
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
-
May 12th, 2002, 05:19 PM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|