Don't tell us the way you're trying to implement what you want to do :P Just tell us what you want to do.
You want to open some files and refer to them as "line0", "line1" etc... ? In that case, you may want to associate the file handlers (e.g. ifstream pointers) with strings (map<string,ifstream*>)
You want to open a file and store its lines in variables named "line0", "line1" etc... ?
Something else?
Try being more specific on describing the problem you have, and not your approach to solve it.
Thats correct. But you nust know that some people dont know english good. If the forum language is in ancient greek with pleasure i write my thouts with the right way.
Εντάξει λοιπόν και σε ευχαριστώ. Να λοιπόν τι θέλω να κάνω. Έχω τρία αρχεία που δημιουργούνται από ένα άλλο project, τα οποία μπορεί να είναι και περισσότερα. Δεν είναι γνωστός ο αριθμός τους.
Πρέπει όλα αυτά τα αρχεία, τα οποία είναι ascii να τα φορτώσω σε conatiners με τίλους ανάλογους.
Παράδειγμα.
Ψάχνω λοιπόν μια μέθοδο με την οποία θα δίνω τον αριθμό των αρχείων και το πρόθεμα, εδώ είναι το f.
Νομίζω ότι στη C μπορεί να γίνει η δημιουργία ονόματος μεταβλητής σε πραγματικό χρόνο, δηλαδή όταν τρέχει το πρόγραμμα. Με αυτό τον τρόπο ένα loop θα δημιουργούσε τις μεταβλητές, μια διαδικασία θα άνοιγε τα αρχεία και τέλος θα συνέχιζε η ροή του προγράμματος χωρίς να είμαστε αναγκασμένοι σε δημιουργία μεταβλητών από πριν καθορισμένων.
Στη lisp γίνεται αυτό εύκολα. Στη C κάποτε παλαιότερα το είχα συναντήσει.
Ευχαριστώ και καλό βράδυ, αν είστε εδώ Ελλάδα.
Ok, I think the solution to your problem is simple. Try this -> vector < vector <string> > files; This is a vector of vectors of strings. Since each inner vector represents one file, the outer vector is actually a container of files. And since it's a vector, it can grow at will during run-time. You can then do something like this: