Advertisement
Guest User

How to paste With Chloe And Alexis

a guest
Jan 18th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. AP_Text_File::AP_Text_File(){
  2.  
  3. File_Name="text.txt";
  4. File_Directory="text.txt";
  5. }
  6. int AP_Text_File::return_Number_Char(){
  7.  
  8. ofstream writefile;//--------------------------------------------used to write to files
  9. ifstream readfile;//---------------------------------------------used to open files
  10. string content;
  11.  
  12. string filename;
  13. filename=File_Name;//-----------------------------------temporary sets the file name
  14.  
  15. readfile.open(filename.c_str());//-------------------------------opens the name with name
  16.  
  17. if(readfile.fail()){//-------------------------------------------If file does not exist....
  18. writefile.open(filename.c_str());//------------------------------The file will be created
  19. //cout<<"Creating "<<filename<<endl;//-----------------------------displays what is being created
  20. };
  21.  
  22. if(!readfile.fail()){//------------------------------------------If the file already exists then...
  23. while(!readfile.eof()){//------------------------------------While the open file is not at the end of file...
  24. string store;
  25. getline(readfile, store);//---------------------------gets that line from file and stores it in store
  26. content=content+store;
  27. };
  28.  
  29. };
  30.  
  31.  
  32. writefile.close();//---------------------------------------------Closes the file (took me along time lol)
  33. readfile.close();//----------------------------------------------Closes the file
  34.  
  35.  
  36. return content.size();
  37. )))))))))))))))))))))))))))))))))))))))))))))))))))ÿà  2 2" ÿä  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement