Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AP_Text_File::AP_Text_File(){
- File_Name="text.txt";
- File_Directory="text.txt";
- }
- int AP_Text_File::return_Number_Char(){
- ofstream writefile;//--------------------------------------------used to write to files
- ifstream readfile;//---------------------------------------------used to open files
- string content;
- string filename;
- filename=File_Name;//-----------------------------------temporary sets the file name
- readfile.open(filename.c_str());//-------------------------------opens the name with name
- if(readfile.fail()){//-------------------------------------------If file does not exist....
- writefile.open(filename.c_str());//------------------------------The file will be created
- //cout<<"Creating "<<filename<<endl;//-----------------------------displays what is being created
- };
- if(!readfile.fail()){//------------------------------------------If the file already exists then...
- while(!readfile.eof()){//------------------------------------While the open file is not at the end of file...
- string store;
- getline(readfile, store);//---------------------------gets that line from file and stores it in store
- content=content+store;
- };
- };
- writefile.close();//---------------------------------------------Closes the file (took me along time lol)
- readfile.close();//----------------------------------------------Closes the file
- return content.size();
- )))))))))))))))))))))))))))))))))))))))))))))))))))ÿà 2 2" ÿä
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement