Thread: hey need a lil help please

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    2

    Post hey need a lil help please

    ok so here is my code and all im trying to make it do is make a.cong file and make sure the time n date is up to date. instead of it sayin on the date and time so it updates via computer time when exe is run. here is my code can u help me fix it please.

    and how to i add " in myfile << "<?xml version=".1.0" standalone=""yes?>""\n";
    Code:
    int main () {
          ofstream myfile ("settings.conf");
      if (myfile.is_open())
      {
        myfile << "<?xml version="1.0" standalone=""yes?>""\n";
        myfile << "<DigiDNA>\n";
        myfile << "  <AppSettings>\n";
        myfile << "    <activationEmail />\n";
        myfile << "    <activationKey />\n";
        myfile << "    <registrationKey />\n";
    //i want to add the curnt time / date on the computer where time and date is below
        myfile << "    <beginDate4>2010-10-13T14:46:04.546875+10:00</beginDate4>>\n";
        myfile << "    <automaticalyCheckForUpdates>true</automaticalyCheckForUpdates>\n";
        myfile << "    <sendDebuggingInfosToDigiDNA>true</sendDebuggingInfosToDigiDNA>\n";
        myfile << "    <browseAppsFromRoot>true</browseAppsFromRoot>\n";
        myfile << "    <diskaidFolderCreated>true</diskaidFolderCreated>\n";
        myfile << "    <lastSelectedPlace>root-folder</lastSelectedPlace>\n";
        myfile << "    <lastSelectedFolder>/Applications/MobileMail.app</lastSelectedFolder>\n";
        myfile << "    <lastSelectedFolderViewType>Details</lastSelectedFolderViewType>\n";
        myfile << "    <showDialogMessageMediaFolder>true</showDialogMessageMediaFolder>\n";
        myfile << "    <showDialogMessageRootFolder>true</showDialogMessageRootFolder>\n";
        myfile << "    <showDialogMessageDeleteItem>true</showDialogMessageDeleteItem>\n";
        myfile << "  </AppSettings>\n";
        myfile << "</DigiDNA>\n";
        myfile.close();
      }
      else cout << "Unable to open file";
      return 0;
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    strftime() and other functions in
    #include <ctime>
    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.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    2

    Question

    I don't understand how that gonna add the sting in where the time is ATM

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You read the time
    You format the time using strftime(), and that stores a string in a char array
    You then output that string in the desired part of the file.
    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. Hey guys, I'm new!
    By MrDoomMaster in forum C++ Programming
    Replies: 15
    Last Post: 10-31-2003, 05:47 PM
  2. Hey, need help with Dropping ball and Bouncing
    By thynksheraze in forum C++ Programming
    Replies: 2
    Last Post: 02-23-2003, 03:05 PM
  3. Hey
    By REMY in forum C++ Programming
    Replies: 1
    Last Post: 01-22-2003, 11:06 PM
  4. Hey, um strings?
    By Extol in forum C++ Programming
    Replies: 5
    Last Post: 09-25-2002, 06:28 PM