Skip to content

Instantly share code, notes, and snippets.

@johnhmj
Created November 1, 2010 09:01
Show Gist options
  • Save johnhmj/657867 to your computer and use it in GitHub Desktop.
Save johnhmj/657867 to your computer and use it in GitHub Desktop.
#include<iostream>
#include<cstdlib>
#include<fstream>
#define BUFFERSIZE 1024
using namespace std;
void main(int argc, char* argv[])
{
// 檔案名稱
const char* fn = "123.txt";
fstream f;
f.open(fn, ios_base::in);
if ( f.is_open() )
{
// 緩衝區
char buffer[BUFFERSIZE] = {0};
while ( ! f.eof() )
{
f >> buffer;
//
// 自行加程式碥:四則運算或是其他運算
//
}
f.close();
}
system("PAUSE");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment