sched file read complete
This commit is contained in:
		
							parent
							
								
									f243104cf9
								
							
						
					
					
						commit
						aee8de18b2
					
				| 
						 | 
					@ -3,13 +3,20 @@
 | 
				
			||||||
#include <cstring>
 | 
					#include <cstring>
 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
#include <chrono>
 | 
					#include <chrono>
 | 
				
			||||||
 | 
					#include <sstream>
 | 
				
			||||||
 | 
					#include <string>
 | 
				
			||||||
 | 
					#include <bits/stdc++.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace std;
 | 
					using namespace std;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void fifo() {
 | 
					void fifo() {
 | 
				
			||||||
 | 
						cout << "fifo" << endl;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct process_detail {
 | 
				
			||||||
 | 
						vector<int> burst_times;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char **argv) {
 | 
					int main(int argc, char **argv) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(argc != 3)
 | 
					    if(argc != 3)
 | 
				
			||||||
| 
						 | 
					@ -23,14 +30,38 @@ int main(int argc, char **argv) {
 | 
				
			||||||
    char *file_to_search_in = argv[1];
 | 
					    char *file_to_search_in = argv[1];
 | 
				
			||||||
	char *scheduler_algorithm = argv[2];
 | 
						char *scheduler_algorithm = argv[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    vector<struct process_detail> processes_detail;
 | 
				
			||||||
    ifstream file(file_to_search_in, ios::binary);
 | 
					    ifstream file(file_to_search_in, ios::binary);
 | 
				
			||||||
    string buffer;
 | 
					    string buffer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while(getline(file, buffer)) {
 | 
					    while(getline(file, buffer)) {
 | 
				
			||||||
		if(buffer[0] == '<'){
 | 
							if(buffer[0] == '<'){
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
        cout << buffer << endl;
 | 
							istringstream iss(buffer);
 | 
				
			||||||
 | 
							string word;
 | 
				
			||||||
 | 
							struct process_detail pd;
 | 
				
			||||||
 | 
							memset(&pd,0,sizeof(struct process_detail));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							while(iss>>word){
 | 
				
			||||||
 | 
								pd.burst_times.push_back(stoi(word));
 | 
				
			||||||
 | 
								cout << stoi(word) << endl;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							processes_detail.push_back(pd);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						map<string, int> temp;
 | 
				
			||||||
 | 
						temp["fifo"] = 1;
 | 
				
			||||||
 | 
						string temp1 = scheduler_algorithm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						switch(temp[temp1]){
 | 
				
			||||||
 | 
							case 1:
 | 
				
			||||||
 | 
								fifo();
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								cout << "enter fifo" << endl;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue