Thread: Problem with time.h

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    16

    Problem with time.h

    Code:
    #include <time.h>
    
    time_t plaintime;
    tm *ptm;
     
    time(&plaintime);
    ptm = localtime(&plaintime);
    if (ptm.tm_hour >= 0 && ptm.tm_hour <= 4)
     {cout << "A special message!...";}
    My problem is within the if statement...why can't I access these parts of the tm structure? Do they not exist?

    Help greatly appreciated!
    The Random Plane
    My website of original old school games.

  2. #2
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    ptm is a pointer, access its members using -> instead of .

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    16
    Thanks...that was a silly mistake on my part.
    The Random Plane
    My website of original old school games.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM