I need to use the overloaded >> this way
Code:// while "std::cin >> process" is succesfull while (std::cin >> process && !(ph.isFull())) { // do something }Code:std::istream &operator>>(std::istream &stream, PCB &pcb) char* temp = new char[MAX_HOOK_LEN]; // Temporary holder for process info stream >> pcb.pid; if (pcb.pid == -1) { // '-1' indicates end of input return ???? //what to return } stream >> pcb.arrival_time; stream >> pcb.last_cpu_burst; stream >> pcb.test_cpu_burst; stream >> pcb.priority; stream >> pcb.state_status; if (stream.getline(temp, MAX_HOOK_LEN, '\n')){ pcb.hook = temp; } return stream; }



LinkBack URL
About LinkBacks


