Thread: delete

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    22

    delete

    Code:
    char *pdest;
    if (pdest = strstr(rawdata, "\"inbox\"") {
       delete [] pdest;
    }
    what am i doing wrong with that?
    when running in debug mode, i get errors:
    "Previous frame inner to this frame (corrupt stack?)"

    it happens at the delete step. am i using the wrong syntax?

    noob out

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You only delete[] what you new[].
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Well...

    EDIT: Ken got it first and better than I did.

    You are also missing a closing parenthesis, btw
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    22
    thanks

    oh, and the closing ) was there, just bad copy/pasting

    thanks again guys.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proper Usage of the delete Operator
    By thetinman in forum C++ Programming
    Replies: 7
    Last Post: 04-25-2007, 11:53 PM
  2. BST delete again, but this time I think I'm close
    By tms43 in forum C++ Programming
    Replies: 9
    Last Post: 11-05-2006, 06:24 PM
  3. delete and delete []
    By Lionel in forum C++ Programming
    Replies: 8
    Last Post: 05-19-2005, 01:52 PM
  4. why is this prog crashing on delete?
    By Waldo2k2 in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 11:17 PM
  5. Problem need help
    By Srpurdy in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2002, 12:45 PM