Thread: Getting strange output!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by mondaytofriday
    I don't know how long endText would be, but I need to append '\0' to the end of it.
    No, you don't. strstr returns a pointer to somewhere within the search that you are searching, hence it is also null terminated.

    Quote Originally Posted by mondaytofriday
    Well I can use things like std::cout in my code for now, but will need to remove them later for the final build, as the final product will need to run on a C-only system.
    Why not just use C facilities then, e.g., printf?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #2
    Registered User
    Join Date
    Jun 2013
    Posts
    27
    Quote Originally Posted by laserlight View Post
    No, you don't. strstr returns a pointer to somewhere within the search that you are searching, hence it is also null terminated.


    Why not just use C facilities then, e.g., printf?

    I do use printf in other places, just prefer std::cout for temporary logging as I used to use it in my happy C++ days

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange Output
    By jokes_finder in forum C Programming
    Replies: 1
    Last Post: 05-13-2011, 07:44 AM
  2. Strange Output
    By ThLstN in forum C Programming
    Replies: 2
    Last Post: 04-05-2008, 12:27 PM
  3. Strange Output
    By newby01 in forum C Programming
    Replies: 1
    Last Post: 01-21-2008, 04:07 AM
  4. output bit strange
    By onthewaytoC in forum C Programming
    Replies: 5
    Last Post: 06-10-2005, 05:36 AM
  5. Strange output ---need help
    By jack_2205 in forum C Programming
    Replies: 7
    Last Post: 02-21-2002, 07:07 PM

Tags for this Thread