Output Text File Name by Today's Date

This is a discussion on Output Text File Name by Today's Date within the C++ Programming forums, part of the General Programming Boards category; Hello, I am working with various log files, and I will be using the log file to extract certain criteria ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    1

    Output Text File Name by Today's Date

    Hello,

    I am working with various log files, and I will be using the log file to extract certain criteria based on some condition. However, I need a program that will save a text file by today's date. Is there an easy way to accomplish this...maybe by calling a library? Below is just an example of outputting to a text file by manually putting today's date, however, I would rather automate that.

    Any insight/recommendations would be great. Thanks!


    Code:
    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    int main () {
          ofstream outF;
          outF.open ("20070709.txt");
          outF << "Output Text Junk Here...";
          outF.close();
          
          return 0;
    }

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    http://faq.cprogramming.com/cgi-bin/...&id=1043284392

    For C++, include ctime. For C include time.h.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Removing text between /* */ in a file
    By 0rion in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 08:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21