Thread: File Handling problem

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    2

    Arrow File Handling problem

    I have a text file which consists of many lines of date, time and other information which is coming from production line.

    Problem is that I have a this kind of text file

    __7/9/03, 12:13:32 AM, etc......

    I'm parsing this file so that it has a finnish date and time like:

    7.9.2003 00:13:32, etc....

    It's working allmost perfectly but when I do an if statements like:


    if (strcmp(ampm, "AM") && hour == 12)
    {
    outputFile << "00" << ":" << minutes << ":" << seconds << endl;
    }

    else if (strcmp(ampm,"AM") && hour < 12)
    {
    outputFile << hour << ":" << minutes << ":" << seconds << endl;
    }


    else if (strcmp(ampm,"PM") && hour < 12)
    {
    hour = (hour + 12);
    outputFile << hour << ":" << minutes << ":" << seconds << endl;
    }

    else if (strcmp(ampm,"PM") && hour == 12)
    {
    outputFile << hour << ":" << minutes << ":" << seconds << endl;
    }


    So the PM thing works correctly example: if time is 3:23:03 PM it's 14:23:03 in finnish time.. But the AM thing for anything that begins 12:**:** won't work.. It only put's same time to outputFile..

    Any suggestions how to do that?

    And Thanks in advance!

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    2
    Thanks man! I't worked!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. basic file handling problem
    By georgen1 in forum C Programming
    Replies: 4
    Last Post: 03-05-2009, 06:21 AM
  4. Problem while dealing with file handling functions
    By RoshanGautam in forum C Programming
    Replies: 3
    Last Post: 02-22-2006, 01:42 AM
  5. file handling and function problem.
    By prepare in forum C Programming
    Replies: 7
    Last Post: 10-09-2004, 02:26 AM