Help on File Creation with Date...

This is a discussion on Help on File Creation with Date... within the C Programming forums, part of the General Programming Boards category; Dear Friends, #define DATE "date +%y%m%d%H%M%S>" if((CreateFile(HotName,Extension)) != SUCCESS) { printf("\ncftodat. Process %d Error Creating the ERROR file ..\r\n",pid); printf("\ncftodat. ...

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    19

    Help on File Creation with Date...

    Dear Friends,

    #define DATE "date +%y%m%d%H%M%S>"

    if((CreateFile(HotName,Extension)) != SUCCESS)
    {
    printf("\ncftodat. Process %d Error Creating the ERROR file ..\r\n",pid);
    printf("\ncftodat. Process %d Terminating ..\r\n",pid);
    exit(0);
    }

    --------------

    int CreateFile(char *HotN,char *Extn)
    char TmpDt[30], *tmpname ;
    {
    printf("I am in CreateFile with parameters %s as Name and %s as Extension \n\n",HotN,Extn);
    tmpname = tmpnam(NULL);
    sprintf(TmpDt,"%s %s",DATE,tmpname);
    system(TmpDt);
    strcat(HotN,tmpname);
    strcat(HotN,Extn);
    return(SUCCESS);
    }


    --------

    this code is giving me error.... on the line having code
    Missing ";". (nosemi)
    char TmpDt[30], *tmpname ;
    ^

    Please help !!! Actually my idea is to create a file with timestamp and have starting of the file name and extension of the file name send as parameter.

    with best regards & Thanks
    Mehul Doshi

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    9
    int CreateFile(char *HotN,char *Extn)
    char TmpDt[30], *tmpname ;
    {

    change to:

    Code:
    int CreateFile(char *HotN, char *Extn) {
    char TmpDt[30], *tmpname;

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    19

    File Creation with Date value - DONE

    Dear jabrams,

    thank you very much. I got the probelm sorted out ....

    It solved the problem but not understood what was really the mistake.... if you can help me understand and remember in future to keep in mind....

    with best regards
    Mehul Doshi.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 03:28 PM

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