Skip to content

Instantly share code, notes, and snippets.

View Ziaeemehr's full-sized avatar
💭
Women-Life-Freedom✌️

A. Ziaeemehr Ziaeemehr

💭
Women-Life-Freedom✌️
View GitHub Profile
// 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();
import numpy as np
x = np.fromfile("X.bin", dtype=float, count=-1)
# dtype: float for double,
# np.uint32 for integer.