c++ char*作为函数参数

人,唯一剥夺不了的,只有知识 / 2024-06-11 / 原文

#include "stdafx.h"
#include <iostream>
using namespace std;

bool uc_is_usb(char *devid)
{
	return strlen(devid) > 3 && devid[0] == 'U' && devid[1] == 'S' && devid[2] == 'B';
}
int _tmain(int argc, _TCHAR* argv[])
{
	char ausb[5] = "USB_";
	if (uc_is_usb(ausb))
		std::cout << "hello,world" << std::endl;
 	system("PAUSE");
	return 0;
}