dynamic filename to be opened

Good morning,

my question is the following. I'm using DEV C++ and I would like, inside a cycle, to ask the program to open an already existing file .txt whose name is running from data-0.txt to data-1.txt to data-2.txt..... to data-i.txt...to data-N.txt where N is equal to 100, let's say.
I'm not able to write such code, could you please give me any help?

Thank you a lot

Stefano
First: are you using the deprecated version of Dev C++ that contains ancient compiler? If yes, that can explain some problems.

Show the code that you already have and explain where/how it fails.
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<fstream>
#include<sstream>
#include<stdlib.h>

#define Nj 1

using namespace std;

int main(){

int i;
char number [15];

for(i=0; i< Nj; i++){

ifstream OpenFile("b%i.txt");

int l=0;

while(!OpenFile.eof()) {

OpenFile >> number [l];
l++;

}

OpenFile.close();

ofstream SaveFile("totale_bj.txt");

int r;

for(r=0; r<3; r++){
SaveFile << number[r];
}

SaveFile.close();

}

}


When I compile I don't have any problem but when I run it doesn't work. Even when I do the Debug it gets blocked.
It was a long time I didn't write any c++ code line so, last week, I randomly look for a compiler in the web and I ended up with Dev c++.
If you think this can be connected with Dev C++ not being a good program could you please suggest me a better one?
Topic archived. No new replies allowed.