änderungen für den memoryaccess key Cigerxwin Chaker
This commit is contained in:
parent
121ae391c0
commit
0c24818614
@ -28,6 +28,8 @@ int main(int argc, char** argv)
|
||||
std::cout << "OUTPUT ------------------------ OUTPUT\n" << std::endl;
|
||||
//Memory that is used now
|
||||
//outprint of all memory
|
||||
} else if (eingabe != "exit"){
|
||||
std::cout << eingabe << " <- is not a known command" << std::endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1,14 +1,20 @@
|
||||
#include <cstdlib>
|
||||
#include "SharedMemory.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
key_t changedKey()
|
||||
{
|
||||
std::ofstream keyFile;
|
||||
keyFile.open("key.log", std::ofstream::out | std::ofstream::trunc);
|
||||
keyFile.clear();
|
||||
int newKey;
|
||||
std::cout << "Type in a new Key for the Shared Memory Segment" << std::endl;
|
||||
std::cout << "new Key#";
|
||||
std::cin >> newKey;
|
||||
std::cout <<"New Key is -> " << newKey << std::endl;
|
||||
keyFile << newKey;
|
||||
keyFile.close();
|
||||
return key_t(newKey);
|
||||
}
|
||||
|
||||
@ -36,9 +42,7 @@ void initSharedMemory(void) {
|
||||
std::string answer = getAnswerFromUser();
|
||||
if(answer.compare("y") == 0)
|
||||
{
|
||||
std::cout << "Please type in a new Key:\n";
|
||||
std::cout << "#";
|
||||
std::cin >> impl.sharedMemoryKey;
|
||||
impl.sharedMemoryKey = changedKey();
|
||||
std::cout << "new Try with Key:c " << impl.sharedMemoryKey << std::endl;
|
||||
initSharedMemory();
|
||||
} else if(answer.compare("n") == 0) {
|
||||
|
@ -12,4 +12,6 @@
|
||||
void deleteSharedMemory(int s);
|
||||
void deleteSharedMemory(void);
|
||||
void initSharedMemory(void);
|
||||
key_t changedKey();
|
||||
std::string getAnswerFromUser();
|
||||
#endif //SHARED_MEMORY_H
|
||||
|
1
src/key.log
Normal file
1
src/key.log
Normal file
@ -0,0 +1 @@
|
||||
12345
|
Loading…
Reference in New Issue
Block a user