aboutsummaryrefslogtreecommitdiff
path: root/week12/Exercise3/MobileDevice.cpp
blob: 982065834e6825c4e862cd0212c3eabef4551576 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "MobileDevice.h"
#include <cstring>
#include <iostream>

bool MobileDevice::CanAccept(const char* hyperMessage) {
	unsigned msgNumber = atoi(hyperMessage);
	return msgNumber == phoneNumber;
}

void MobileDevice::Accept(const char* hyperMessage) {
	if (!CanAccept(hyperMessage)) {
		throw "Can't accept message!";
	}
	strncpy(textMessage, strchr(hyperMessage, ' ') + 1, 512);
}