I wrote small proggy..and I dunno why it doesnt work...can you help me?

#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <sstream>
#include <iostream>
    
  using namespace std;  
    
int main()
{
string option[] = {"option1.txt","option2.txt","option3.txt","option4.txt"};
string token;
string filename_token;
string line,filename,filename1,c0,c1,c2,c3,c4,c5,c6;
int i=4;
int n;
ofstream result ("raport.csv");
                                   for(n=0; n<i+1 ; n++)
                                            {
                                            cout << option[n];
                                            filename1==option[n];
                                            ifstream pliczek (filename1.c_str()); //otwieramy wszystkie pliki
                                            while (! pliczek.eof())
                                                  {
                                                  getline (pliczek,line);
                                                  result << line << ";";
                                                  cout << line << endl;
                                                  }
                                            result << endl;
                                            }
}

THX in advance!

Recommended Answers

All 4 Replies

Are you getting compiler errors? Runtime errors? Is it that your program logic isn't working properly (ie your not getting the expected output)?
Please be more specific and we can help you. Thanks :)

No errors at all..It just doesnt work...I just get output file full of ";" chars...
there is infinite loop somewhere..and it doesnt get line from every file from array..It produces ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; only.

Look at line 26. Anything suspicious there?

Yes...its suspicious...I dunno if its possible to do that (seeing the results, probably not), but i dunno how to fix that...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.