#include <ctime> #include<iomanip> #include <iostream> #include<string> using namespace std; void read_network(vector <vector<int> > &VCMA_network){ //read network from input files char *file; ifstream fin; string path,name; path="/global/scratch/jiansen6/network-input/"; name=path+"stubs.dat1"; cout <<"input file name "<<name<<endl; file=new char[name.size()+1]; strcpy (file, name.c_str()); fin.open(file); if (fin.is_open()){ string line; while ( getline(fin, line) ) { istringstream ss(line); vector < int > data; int value; // for data separate by space while (ss >> value) { data.push_back(value); } // for data separate by comma /* char output[30]; while ( ss.getline(output, sizeof(output),',') ){ value = atoi(output); //convert char to int data.push_back(value);} */ VCMA_network.push_back(data); }//end of while } //end of fin.is_open else{ cout<<"Problem with opening the file "<<name<<endl; exit(1); } fin.close(); }
Online computer courses, code, programming tutorial and sidebar information for monitoring Canadian S&P/TSX index. Build friendship and networking. Welcome to visit my blogs often!!! I also have two other sites: YouTube Channel and Google site.
Adsense
Popular Posts
- PHPWind-- A PHP forum script applcaition in China
- How to blend adsense inside your post?
- Formatting my post
- Notepad++ - Add C++ compiler
- Install PHPMailer 5.2.4 and use smtp gmail
- Wayback Machine - see archived versions of web pages across time
- Set up a child account and set screen time limit in Windows 8
- phpexcel toggle expand and hide column in EXCEL and summary
- Install PHP ibm_db2 extension in Linux (redHat)
- PHP: add a download as pdf file button in report page
Friday, July 2, 2010
read in file to vector arrary --C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment