Posts

Showing posts from November, 2018

Copy assignment operator, the rule of three [on hold]

Image
up vote -2 down vote favorite Did I understand it right, that I need a copy assignment operator here according to the rule of three (https://en.cppreference.com/w/cpp/language/rule_of_three)? If yes, can I write it like this: mystring& operator=(mystring other) ? struct mystring { char *text; int len; mystring(const char *txt) { len=strlen(txt); text=new char[len+1]; strcpy(text,txt); } mystring(const mystring &s) { len=s.len; text=new char[len+1]; strcpy(text,s.text); } ~mystring() { delete text; } void append(const char*); char &at(int i) {return text[i];}; void print() {cout<<text<<endl;} }; void mystring::append(const char *txt) { char *tmp=new char[len+strlen(txt)+1]; strcpy

Use /30 netmask in Debian with bridged adapter in VirtualBox

Image
up vote 0 down vote favorite I have Debian 9.6 installed in VirtualBox with bridged adapter. My question is, how to config my interfaces to have /30 netmask? I tried a lot a different things but I can't connect my host to the VM with ssh and so the vm isn't connect to the Internet. My /etc/network/interfaces conf: iface enp0s3 inet static address 10.0.0.2 netmask 255.255.255.252 broadcast 10.0.0.3 gateway 192.168.1.1 and like I said the network conf in VirtualBox is "Bridged Adapter" 192.168.1.1 is my router 192.168.1.50 is my computer. Usualy I don't touch to the netmask because I don't need to touch that, but now I am stuck for a project. Can someone explain how to config my interfaces to have a working /30 netmask and what is netmask?