fstream appearing to not function properly

i'm working on a program which creates data and saves it into blocks (different files), then reloads and converts it all. the .ftl file saves properly, but for some unknown reason, it won't let me open it for input after. here's the significant code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>

stringstream filename;
stringstream newfilename;
string Filename;

int main ()
{
   for (blocky = 1; blocky <= setblock; blocky++)
      {for (blockx = 1; blockx <= setblock; blockx++)
         {
            //create data
            newfilename << filename.str() << " [" << blockx << "] [" << blocky << "].ftl\0";
            Filename = newfilename.str();
            newfilename.str(string()); //clears newfilename
            ofstream outputfile;
            outputfile.open (Filename.c_str(), ios::binary);
            if (!outputfile.is_open())
            {
               return 0;
            }
            outputfile.write ((char*)(&intzero), 2);
            //... writes file header in this way ^ , and data written in a for loop extracting data from an array which occurs successfully
            outputfile.close();
         }
      }
   for (blocky = 1; blocky <= setblock; blocky++)
      {for (blockx = 1; blockx <= setblock; blockx++)
         {
            newfilename << filename.str() << " [" << blockx << "] [" << blocky << "].ftl\0";
            Filename = newfilename.str();
            newfilename.str(string());
            ifstream inputfile;
            inputfile.open (Filename.c_str(), ios::binary);
            if (!inputfile.is_open());
            {
               cout << "file not loaded for d to usi conversion...\n"; //code runs thru this line and ends
               return 0;
            }
            //read data
         }
      }
}


setblock will typically = 3, but for testing purposes is set to 1. this really has me confused. the compiler i'm using is Dev-C++ 5.2.0.1 on xp. i have tried pausing the program after the output file is closed, confirming the file has been created in the proper directory before continuing but still fails the .is_open() check. I would appreciate any comments thanks!!
Do you see a semi-colon on line 38 that shouldn't be there?
How silly of me, wow epic fail. thank you, i can't believe i missed that. i'm running my test now, should take about 20 min. my first reaction was that it was a typo in retyping my code
all good
Back when I first tried to write a C program the compiler diagnostics were not too good. It took me a week to figure out that I was missing a } somewhere.
Topic archived. No new replies allowed.