تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
هل يمكن قراءة ملف txt من موقع
#5
(15-09-16, 12:07 AM)أبو عمر كتب : آآآآآآآآآآآآآسف جداً
PHP كود :
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
 
int main() {
 
  string filename "test.txt";
 
 
  // Write to File
 
  ofstream fout(filename.c_str());  // default mode is ios::out | ios::trunc
 
  if (!fout) {
 
     cerr << "error: open file for output failed!" << endl;
 
     abort();  // in <cstdlib> header
 
  }
 
  fout << "apple" << endl;
 
  fout << "orange" << endl;
 
  fout << "banana" << endl;
 
  fout.close();
 
 
  // Read from file
 
  ifstream fin(filename.c_str());  // default mode ios::in
 
  if (!fin) {
 
     cerr << "error: open file for input failed!" << endl;
 
     abort();
 
  }
 
  char ch;
 
  while (fin.get(ch)) {  // till end-of-file
 
     cout << ch;
 
  }
 
  fin.close();
 
  return 0;


ظننت المشاركة في قسم VB
جزاك الله خير
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: هل يمكن قراءة ملف txt من موقع - بواسطة Mohamed20 - 15-09-16, 12:47 AM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم