/********************************************************** // Author: Abdirahim Abdi // Assignment: Lab 2 // Class: CSE 660 - Operating Systems // Description: Operating System Commands // File BB.cpp **********************************************************/ #include #include #include #include #include #include #include using namespace std; /*************************************/ int main() { cout << "Process ID BB" << ": " << getpid() << "(CODE BB)" << " -Creating a file XYZ.txt and writing 150 characters to it.\n\n"; mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH; char buffer[150]; int readBuffer, reverseCount = 0; int fileID_XY = open("/usr/class/cis660/x.y", mode); int fileID_XYZ = creat("XYZ.txt", mode); lseek(fileID_XY, -150, 2); readBuffer = read(fileID_XY, &buffer, 150); write(fileID_XYZ, &buffer, 150); cout << "Process ID BB" << ": " << getpid() << "(CODE BB)" << " - Done and terminating.\n\n"; exit(0); }