Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int SelenaJobsManager::RestoryJ(SelenaJob& J, char stage)
- {
- if (!J.storageName.length())
- return -1;
- std::ifstream f;
- std::string sn;
- if (stage == 1)
- goto m_current;
- if (stage == 2)
- goto m_results;
- FullStorageName(J.storageName, sn);
- sn += ".job";
- // RU. ������� ������ ������� �� ���������� ������.
- // EN. Attempt to read job assignment.
- f.open(sn, std::ios::out | std::ios::binary);
- if (!f.is_open()) {
- m_current:;
- // RU. ������� ������ ������� ������.
- // EN. Attempt to read current job.
- sn = ("_" + J.storageName);
- FullStorageName(sn, sn);
- sn += ".job";
- f.open(sn, std::ios::out | std::ios::binary);
- if (!f.is_open()) {
- m_results:;
- // RU. ������� ������ ����������� ����������� ������.
- // EN. An attempt to read the results of the performed work
- sn = ("__" + J.storageName);
- FullStorageName(sn, sn);
- sn += ".job";
- f.open(sn, std::ios::out | std::ios::binary);
- } }
- if (!f.is_open()) return -1;
- SelenaJob JR;
- JR.storageName = J.storageName;
- f.read(reinterpret_cast<char*>(&JR.stage), sizeof(J.stage));
- f.read(reinterpret_cast<char*>(&JR.completCode), sizeof(J.completCode));
- f.read(reinterpret_cast<char*>(&JR.h), sizeof(J.h));
- char* buf = nullptr;
- int n = 0;
- ReadNameString(f, &buf, n, JR.command);
- ReadNameString(f, &buf, n, JR.fileInputName);
- ReadNameString(f, &buf, n, JR.fileOutputName);
- ReadNameString(f, &buf, n, JR.errorMessage);
- J = JR;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement