Looping over a directory

Can anyone find a reason why this wouldn’t work? When I execute the code, I don’t get any errors, but a completely blank tree and nothing in the while loop seems to be executed.

#include “TDatime.h”
#include “TTree.h”
#include “TFile.h”
#include “TSystem.h”

void main()
bool infile;
std::string output=“BCTdata”;
std::string title=“BCTdata”;
const int Npoints = 12000, Nfiles=119;
int ret =-1, j=0, k=0;
float in, vb, vsmb, arr[Nfiles][Npoints], sum1[Npoints], av;
float v[Npoints], vsm[Npoints];
TFile fc2011((output+".root").c_str(),“recreate”); //creates new ROOT file
TTree tc2011(output.c_str(),title.c_str()); //creates new tree

void *dirp=gSystem->OpenDirectory(“Users/Charlie/root/BCTdata”);
const char *pathandfile= (“Users/Charlie/root/BCTdata/”+infile);
while(infile= gSystem->GetDirEntry(dirp))

    FILE *file;
    file = fopen(pathandfile,"r"); 

for(int i=0; i<=Npoints;i++)
	ret = fscanf(file,"%g%*c",&in);
	v[i] = in;
    cout <<hello<<endl;
    fclose(file); //close file


tc2011.Print(); //print tree in terminal
tc2011.Write(); //write tree to file


I went through the errors that had previously appeared and fixed them as root suggested me too, but it didn’t really seem to solve anything. Thanks for any help!

At least this line is wrong (“pathandfile” will be undefined):
const char *pathandfile= (“Users/Charlie/root/BCTdata/”+infile);