如何在Mac上與終端進行通信,以便我可以完成以下任務? 我想向用戶索要樹莓派的IP或ID,然後利用輸入連接到樹莓派。 我試過下面的代碼,但它不起作用,說「沒有匹配的函數調用系統」。如何在系統中使用終端命令()
cout << "What is the Raspberry Pi's IP address or ID? ";
string raspiID;
cin >> raspiID;
cout << endl;
string command = "ssh [email protected]" + raspiID + "";
system(command);
請不要使用'system()'...有很多更好的方法(沒有安全問題和更多)..只要忘記它存在。 –
爲什麼在命令結尾處有'+「」'? – Barmar
那麼,我試圖看看它是否在'system(「ssh pi @」+ raspiID)'不起作用之後工作。 – Neuranium