I have Snow Leopard and Xcode 3.2. And I need to write little module for my program, which should read file with integer in first line (number of coordinates) and a lot float numbers in other lines (triangulation coordinates).
So, I wrote this program:
It's just first lines, but it don't work well. File pcp.txt located in binary's directory (/build/debug/) and program says that opens it. But file content some numbers like 123 45.67 32.67 etc. And XCode says that nu == 0. I don't know why! This program works perfectly in my friend's Visual Studio 2008. Please, help me!
So, I wrote this program:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ifstream ffile("pcp.txt", ifstream::in);
int nu;
cout << ffile.is_open() << endl; //Verifying was file opened or not`
ffile>>nu; //Trying to read first number from file
cout << nu;
ffile.close();
return 0;
}
It's just first lines, but it don't work well. File pcp.txt located in binary's directory (/build/debug/) and program says that opens it. But file content some numbers like 123 45.67 32.67 etc. And XCode says that nu == 0. I don't know why! This program works perfectly in my friend's Visual Studio 2008. Please, help me!