To write specific data values from large file in c++

ساخت وبلاگ

Vote count: 0

I am mentioning some data of my large data files:

TotEng = -11097.6192 KinEng = 11146.4491 Temp = 303.2194

PotEng = -22244.0684 E_bond = 3836.4889 E_angle = 7976.8498

E_dihed = 486.0938 E_impro = 0.0000 E_vdwl = -2320.3438

E_coul = 36613.6339 E_long = -46944.6797 Press = 551.3530

---------------- Step 31650500 ----- CPU = 15.1942 (sec) ---------------

Here are only 5 lines and in my large data files ,I have 4005 lines whose pattern of writting is similar to above one and in my large data files, I only need Press data which is in decimal form

#include<iostream>
#include<fstream>
#include<string>
#include <unistd.h>
using namespace std;
#define FILE_IN "pressureinputrequire.out"
#define FILE_OUT "pressureoutputrequire.out"
int main()
{
string uselessfirst,uselesssecond,uselessthird,uselessfourth,pressure[801];
ifstream input;
ofstream output;
input.open(FILE_IN);
if(!input)
{
cout<<"n can't find input file"<<FILE_IN;
return 0;}
output.open(FILE_OUT);
while(!input.eof())
{
for(int j=0; j<801; ++j)
{getline(input,uselessfirst); getline(input,uselesssecond); getline(input,uselessthird); input.seekg(66); getline(input,pressure[j]); write(output,pressure[j]); getline(input,uselessfourth); }} input.close(); output.close(); return 0;}

And errors are generating:

1)invalid user-defined conversion from ‘std::ofstream {aka std::basic_ofstream}’ to ‘int’ [-fpermissive] write(output,pressure[j]);

2) cannot convert ‘std::string {aka std::basic_string}’ to ‘const void*’ for argument ‘2’ to ‘ssize_t write(int, const void*, size_t)’ write(output,pressure[j]);

asked 39 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : write to specific line python,write to specific line c,write to specific memory address c,write to specific line java,write to specific line vb net,write to specific line bash,write to specific line php,write to specific address c,write to specific sector,write to specific cell excel matlab, نویسنده : استخدام کار backsoft بازدید : 445 تاريخ : جمعه 23 مهر 1395 ساعت: 5:44