CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: fstream problem

  1. #1
    Join Date
    Sep 2007
    Posts
    44

    fstream problem

    Hey,

    I have the following code
    Code:
    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    int main(int argc, char *argv[]) 
    {
    	ofstream logWrite("CompileLog.log");
    	for(int i=1; i<argc ;i++ ) 
    	{
    	logWrite << argv[i] << endl;
    	cout << argv[i] << endl;
    	system("pause");
    	logWrite.close();
    	}  
    }
    When I compile it, it compiles fine.
    If I start it using CMD "ArgumentTester.exe Hello" it writes to CompileLog.log file.
    But, when I drop a file onto it eg "test.txt" it doesn't write. Doesn't anyone know why..?

    BageDevimo,

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: fstream problem

    What do you mean by "drop a file"?

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Sep 2007
    Posts
    44

    Re: fstream problem

    Like, pick up the a file (click and hold) then drop it onto it...

    Like one might do to open a txt file with notepad...

    BageDevimo,

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: fstream problem

    Quote Originally Posted by BageDevimo
    Like, pick up the a file (click and hold) then drop it onto it...

    Like one might do to open a txt file with notepad...

    BageDevimo,
    Please post your question in the Windows API forum, as this is dependent on the OS (Windows), and title your post differently. This has absolutely nothing to do with fstream, but it has to do with the Windows API and the GUI.

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured