|
-
February 25th, 2012, 10:07 PM
#2
Re: Segmentation fault and also bad initalization
At the moment s is just an uninitialized pointer. It does not point to a valid block of memory, therefore you can't safely write anything to it.
You will find it much, much easier to define s as a std::string and use the <iostream> library for reading/writing, than to fix the problem with s. Fixing the problem with s as it is would be pretty easy for someone who knows C well, but it doesn't sound like you do and thus you are likely to have trouble. The C++ string and IO methods are much more intuitive.
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
|