منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : محتاج مساعده
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
كيف استطيع ان افتح ملف txt واختار نص معينه منه واجراء عمليه حسابية والاخراج كل المدخلات بعد التعديل في ملف txt
تفضل اخي كود تعبئة وتعديل مستند txt


كود :
#include <iostream>
#include <fstream>
using namespace std;

int main () {
 ofstream myfile ("example.txt");
 if (myfile.is_open())
 {
   myfile << "This is a line.\n";
   myfile << "This is another line.\n";
   myfile.close();
 }
 else cout << "Unable to open file";
 return 0;
}


وهاذا كود لمعرفة حجم اي ملف


كود :
#include <iostream>
#include <fstream>
using namespace std;

int main () {
 streampos begin,end;
 ifstream myfile ("example.bin", ios::binary);
 begin = myfile.tellg();
 myfile.seekg (0, ios::end);
 end = myfile.tellg();
 myfile.close();
 cout << "size is: " << (end-begin) << " bytes.\n";
 return 0;
}