File IO

Hopefully this won't sound as stupid to you as it does to me, and if it does, then hopefully it will be a really easy question.

I need to get some information out of my Projectwise program that I can feed into another program.  Either being able to copy and paste the information or being able to write it out to a text file would be great.  I have not been able to get the project to find any of the fstream, iostream headers.  I have tried using printf, and while it compiles and runs, the output doesn't show up anywhere that I could find.

I am using VS 2010 on windows 7 and PW SS2

Thank-you, John

Parents
  • Since you are on Windows 7, you will not be able to create a file in c:\ (C root) or under Program Files.  I am not on Win7 yet (we are testing).

    here is an old snipit that may work for you

    void WriteLineToLog(CString Line)

    {

    FILE *fp;

    COleDateTime now = COleDateTime::GetCurrentTime();

    CString str;

    str.Format(_T("%s - %s\n"),Line,now.Format(_T("%H:%M:%S")));

    _tprintf(str);

    _tfopen_s(&fp,_T("C:\\Users\\Public\\CreatePWFolders.log"),_T("at"));

    fputws(str.GetBuffer(0),fp);

    fclose(fp);

    }

Reply
  • Since you are on Windows 7, you will not be able to create a file in c:\ (C root) or under Program Files.  I am not on Win7 yet (we are testing).

    here is an old snipit that may work for you

    void WriteLineToLog(CString Line)

    {

    FILE *fp;

    COleDateTime now = COleDateTime::GetCurrentTime();

    CString str;

    str.Format(_T("%s - %s\n"),Line,now.Format(_T("%H:%M:%S")));

    _tprintf(str);

    _tfopen_s(&fp,_T("C:\\Users\\Public\\CreatePWFolders.log"),_T("at"));

    fputws(str.GetBuffer(0),fp);

    fclose(fp);

    }

Children