Skip to content

Instantly share code, notes, and snippets.

🙂

A. Ziaeemehr Ziaeemehr

🙂
Block or report user

Report or block Ziaeemehr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View read_in_python.py
import numpy as np
x = np.fromfile("X.bin", dtype=float, count=-1)
# dtype: float for double,
# np.uint32 for integer.
View write_in_CPP.cpp
// open file as binary:
std::ofstream oX((path + "/X.bin").c_str(), std::ios::out | std::ios::binary);
// write a vector into the file
oX.write((char *)&x[0], x.size() * sizeof x[0]);
// close the file
oX.close();
You can’t perform that action at this time.