Thread: ctime adds \n

  1. #1
    Registered User
    Join Date
    Oct 2006

    ctime adds \n

    why in the hell would they do this? it makes no sense to add a newline character, but yet it is the defined behavior of this (and other unix-type time functions). I think it would have been much more flexible if it did not add the \n character. it would make a lot more sense to add one if needed, rather than strip it off if it is unwanted.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    I agree, but it happens to be the way that is was specified originally, so changing it would potentially break existing code.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Oct 2006
    I guess this is a case of "what were they smoking?" after all, it was the late 60's and early 70's when all of this was created....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Classes in C++
    By Kool4School in forum C++ Programming
    Replies: 22
    Last Post: 01-21-2009, 09:26 PM
  2. why only the succeeding value adds up???
    By omarbags in forum C Programming
    Replies: 18
    Last Post: 01-01-2009, 02:28 PM
  3. Replies: 5
    Last Post: 09-26-2006, 01:51 PM
  4. time precision (ctime), tm struct question
    By cjschw in forum C++ Programming
    Replies: 1
    Last Post: 12-26-2003, 01:51 PM
  5. ctime() error...implementation maybe?
    By [EMOBA] in forum C++ Programming
    Replies: 2
    Last Post: 09-26-2002, 03:57 PM