ä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;
|
std::cout << "OUTPUT ------------------------ OUTPUT\n" << std::endl;
|
||||||
//Memory that is used now
|
//Memory that is used now
|
||||||
//outprint of all memory
|
//outprint of all memory
|
||||||
|
} else if (eingabe != "exit"){
|
||||||
|
std::cout << eingabe << " <- is not a known command" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "SharedMemory.h"
|
#include "SharedMemory.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
key_t changedKey()
|
key_t changedKey()
|
||||||
{
|
{
|
||||||
|
std::ofstream keyFile;
|
||||||
|
keyFile.open("key.log", std::ofstream::out | std::ofstream::trunc);
|
||||||
|
keyFile.clear();
|
||||||
int newKey;
|
int newKey;
|
||||||
std::cout << "Type in a new Key for the Shared Memory Segment" << std::endl;
|
std::cout << "Type in a new Key for the Shared Memory Segment" << std::endl;
|
||||||
std::cout << "new Key#";
|
std::cout << "new Key#";
|
||||||
std::cin >> newKey;
|
std::cin >> newKey;
|
||||||
std::cout <<"New Key is -> " << newKey << std::endl;
|
std::cout <<"New Key is -> " << newKey << std::endl;
|
||||||
|
keyFile << newKey;
|
||||||
|
keyFile.close();
|
||||||
return key_t(newKey);
|
return key_t(newKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,9 +42,7 @@ void initSharedMemory(void) {
|
|||||||
std::string answer = getAnswerFromUser();
|
std::string answer = getAnswerFromUser();
|
||||||
if(answer.compare("y") == 0)
|
if(answer.compare("y") == 0)
|
||||||
{
|
{
|
||||||
std::cout << "Please type in a new Key:\n";
|
impl.sharedMemoryKey = changedKey();
|
||||||
std::cout << "#";
|
|
||||||
std::cin >> impl.sharedMemoryKey;
|
|
||||||
std::cout << "new Try with Key:c " << impl.sharedMemoryKey << std::endl;
|
std::cout << "new Try with Key:c " << impl.sharedMemoryKey << std::endl;
|
||||||
initSharedMemory();
|
initSharedMemory();
|
||||||
} else if(answer.compare("n") == 0) {
|
} else if(answer.compare("n") == 0) {
|
||||||
|
@ -12,4 +12,6 @@
|
|||||||
void deleteSharedMemory(int s);
|
void deleteSharedMemory(int s);
|
||||||
void deleteSharedMemory(void);
|
void deleteSharedMemory(void);
|
||||||
void initSharedMemory(void);
|
void initSharedMemory(void);
|
||||||
|
key_t changedKey();
|
||||||
|
std::string getAnswerFromUser();
|
||||||
#endif //SHARED_MEMORY_H
|
#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