read/write .txt on Xcode C++

Discussion in 'Mac Programming' started by z7tjxd45, Dec 6, 2011.

  1. macrumors member

    Joined:
    Sep 7, 2011
    #1
    Code:
    	ifstream fin;
    	fin.open("/Users/Mike/Desktop/data.txt");
    	if (fin.fail())
    	{
    		cerr <<"Unable to open data.txt" << endl;
    		exit(1);
    	
    Is what I have. and Xcode tells me "Error from Debugger. The program being debugged is not being run. I also get an error in terminal.

    data.txt is on the desktop. What am I missing here?
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    It works for me. Are you sure that file exists?
     
  3. Guest

    ppc_michael

    Joined:
    Apr 26, 2005
    Location:
    Los Angeles, CA
  4. macrumors newbie

    Joined:
    Dec 13, 2011
    #4
    I had problems before, what i did was put go into preferences to look for the derived files and put the data text inside the debug folder.
     

Share This Page