Read from file

I'm trying to pull some info from a text file so that I can use the information. My C++ is a bit rusty but I'm trying something like :

#include <ifstream>
#include <cstdlib>
using std::ifstream;
using std::cout;


void setup()
{
  ifstream inStream;
  String temp;
  inStream.open("test.txt");
  inStream >> str1;
  cout << str1;
  inStream.close();

Just to see if I can get something from it, but it's giving me the error:
ifstream: No such file or directory.

Is there a better way to approach this?