Find the answer to your Linux question:
Results 1 to 2 of 2
I've had this problem and so has my friend today. We have a program where we fork() another process and inside of that, we reassign a string that was created ...
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    1

    g++ strings c_str() function and fork()

    I've had this problem and so has my friend today.

    We have a program where we fork() another process and inside of that, we reassign a string that was created outside of the fork(). Inside of the fork, in the child process, a new string should in an essence be created for use. When the value of the string is evaluated, it's correct. However, when we run the c_str() function on it, it acts as if we haven't changed it (maybe it's referring back to the value in the other process). Is this a bug or is this bad usage on our part?

    Thanks.
    David

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    Could we see your code...Thanks

    and welcome to the Linux Forums

Posting Permissions

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