Nel file di classe:
Nel file del metodo maincodice:Class PathA { public: string setPercorso (){ string NomeFile = "campi.txt"; string Path = "a:\\"; string NomeFilePath = Path + NomeFile; return NomeFilePath; } }
codice:#include <iostream> #include <fstream> using namespace std; fstream f; PathA percorso; int main () { string NomeFilePath = percorso.setPercorso (); }