Thread: Copying Cuurent time to string

  1. #1
    Registered User
    Join Date
    May 2012

    Copying Cuurent time to string


    I am trying to copy the current time to a string but it throws a warning in dev c of about some "numeric value conversion to the other string".....I don't remember exactly.....but is the code Ok??

    int main()
    char dte[40];
    time_t present;
    return 0;

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > .I don't remember exactly.....but is the code Ok??
    I'm guessing that since you don't remember the error message, that you also don't remember the code either.

    In other words, you just typed something and posted it here.
    $ gcc -g -Wall foo.c
    foo.c: In function ‘main’:
    foo.c:12:8: error: ‘date’ undeclared (first use in this function)
    foo.c:12:8: note: each undeclared identifier is reported only once for each function it appears in
    foo.c:7:6: warning: unused variable ‘dte’ [-Wunused-variable]
    It doesn't even compile.

    Come back when you can post the actual code you tried to compile, and the actual error messages you got.

    Otherwise, it's just a big waste of time.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 08-10-2011, 05:25 AM
  2. String copying
    By NegativeSpace in forum C++ Programming
    Replies: 7
    Last Post: 06-25-2008, 03:14 AM
  3. Copying a string, into a string array.
    By m.mixon in forum C Programming
    Replies: 5
    Last Post: 07-31-2006, 05:19 PM
  4. String copying
    By bobthebullet990 in forum C Programming
    Replies: 12
    Last Post: 11-28-2005, 09:31 AM
  5. Replies: 1
    Last Post: 10-31-2005, 11:36 AM