M
MyCatAlex
Guest
I have this C++ code that I just wrote but haven't tried yet.
void send860blocks(void)
{
counter = 0;
HANDLE hBFile = CreateFile(_T("Blocks860.dat"), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hBFile == INVALID_HANDLE_VALUE)
{
_tprintf_s(_T("CreateFile hBFile failed with error %d\n"), GetLastError());
return;
}
struct OutMemStream2 {
struct pairs1 {
uint8_t x;
uint8_t y;
};
struct pairs2 {
uint8_t x;
uint8_t y;
};
.................
.................
};
OutMemStream2* ptr;
int gg = sizeof(OutMemStream2);
for (int ii = 0; ii < 860; ii++)
{
memcpy(&hBFile + ii, ptr, gg);
}
}
The meaning here is that there is a file "Blocks860.dat" at an external SSD. The file is empty. I hope to fill it out with structures "OutMemStream2" The number of structures I need is known - 860. Each structure must have a substructure that should hold a pair of integers. Instead of the substructures I could have used 2D vectors, complex numbers, etc. I hope to send there (to the SSD) 860 such structures. The number of substructures containing integer pairs should be about 88.
My question is: "Is it going to work?" And if it is going to work, how can I generate the needed number of structures and substructures for each structure in (a) loop(s).
Thanks, - MyCatAlex
Continue reading...
void send860blocks(void)
{
counter = 0;
HANDLE hBFile = CreateFile(_T("Blocks860.dat"), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hBFile == INVALID_HANDLE_VALUE)
{
_tprintf_s(_T("CreateFile hBFile failed with error %d\n"), GetLastError());
return;
}
struct OutMemStream2 {
struct pairs1 {
uint8_t x;
uint8_t y;
};
struct pairs2 {
uint8_t x;
uint8_t y;
};
.................
.................
};
OutMemStream2* ptr;
int gg = sizeof(OutMemStream2);
for (int ii = 0; ii < 860; ii++)
{
memcpy(&hBFile + ii, ptr, gg);
}
}
The meaning here is that there is a file "Blocks860.dat" at an external SSD. The file is empty. I hope to fill it out with structures "OutMemStream2" The number of structures I need is known - 860. Each structure must have a substructure that should hold a pair of integers. Instead of the substructures I could have used 2D vectors, complex numbers, etc. I hope to send there (to the SSD) 860 such structures. The number of substructures containing integer pairs should be about 88.
My question is: "Is it going to work?" And if it is going to work, how can I generate the needed number of structures and substructures for each structure in (a) loop(s).
Thanks, - MyCatAlex
Continue reading...