0
                        
                    
                    فایل ها در c++
با سلام.
میشه بهم بگین چطوری میتونم تعداد کاراکتر هایی را که در یک فایل به زبان c++ نوشتیم رو بشماریم؟؟
1 پاسخ
                                    
                                    1
                                    
                                    
                                
                                سلام به شما دوست عزیز.این کد رو امتحان کنید:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const char FileName[] = "text.txt";
int main () 
{
string line;
ifstream inMyStream (FileName); 
int count;
if (inMyStream.is_open()) 
{
     while(  getline (inMyStream, line)){
             cout<<line<<endl;
              count+= line.lenght();
  }
    }
    inMyStream.close(); 
system("pause");
   return 0;
}