I want to read the .nrp extension file in Node JS. this is my node js code below.
var fs = require('fs')
fs.readFile('Jun24_Jun30.nrp','utf8', function(err, data) {
if (err) throw err
console.log(data)
})
The output is coming as junk values when I try to read from node js.
But if I try to read the same file in C++ I am getting the correct Output.
this is my C++ code below.
#include <iostream>
#include <stream>
using namespace std;
class ValueGet {
public:
int data;
ValueGet() {
data = 0;
}
};
int main()
{
ValueGet vg;
ifstream file;
file.open("Jun24_Jun30.nrp", fstream::binary | fstream::out);
if (!file)
cout << "File Not Found." << endl;
else {
file.seekg(0);
while (file.read((char *)&vg, sizeof(vg)))
cout<<vg.data<<endl;
}
//system("pause");
return 0;
}
C++ Output:
I want the same output from node js also. Please help.
Thanks!

