Browse Source

更新用例;

scbc 5 năm trước cách đây
mục cha
commit
437ce07516

+ 19 - 0
example_ssh2/example_ssh2/example_ssh2.cpp

@@ -16,6 +16,23 @@ CWinApp theApp;
 
 using namespace std;
 
+void Split(std::string str1, std::string str2, std::vector<std::string> &vt)
+{
+	if ( str1.size() == 0 || str2.size() == 0 )
+		return;
+
+	int npos = str1.find(str2);
+	while( std::string::npos != npos )
+	{
+		vt.push_back(str1.substr(0, npos));
+		str1 = str1.substr(npos + str2.size());
+		npos = str1.find(str2);
+	}
+
+	if ( str1.size() )
+		vt.push_back(str1);
+}
+
 int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 {
 	int nRetCode = 0;
@@ -37,6 +54,8 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 			{
 				std::string data;
 				winssh2.ssh2_execute_command("ls", data);
+				std::vector<std::string> strList;
+				Split(data, "\n", strList);
 				winssh2.ssh2_execute_command("md5sum /scbc_data/exchange/BAK_RT2841_2851_dailybuild/DailyBuild_RT2851_1231/USB/V8-T851T01-debug123103.img", data, 100000);
 				winssh2.ssh2_execute_command("sha1sum /scbc_data/exchange/BAK_RT2841_2851_dailybuild/DailyBuild_RT2851_1231/USB/V8-T851T01-debug123103.img", data, 10000);
 				winssh2.ssh2_execute_command("sha256sum /scbc_data/exchange/BAK_RT2841_2851_dailybuild/DailyBuild_RT2851_1231/USB/V8-T851T01-debug123103.img", data, 10000);

+ 1 - 1
example_ssh2/example_ssh2/stdafx.h

@@ -26,7 +26,7 @@
 #endif // _AFX_NO_AFXCMN_SUPPORT
 
 #include <iostream>
-
+#include <vector>
 
 
 // TODO: 在此处引用程序需要的其他头文件