getfirmversion.c

来自「一个在Linux下开发的IP摄像头的驱动程序及控制软件」· C语言 代码 · 共 51 行

C
51
字号
#include <string.h>
#include "ServerUtl.h"
#include "mainprofile_error.h"

char chFileName[255];

int main(int argc, char* argv[])
{   
	TSERVERUTL_PACK_VERSION_INFO tPackVersionInfo;

	if (HandleFileArgument(argc, argv) < 0)
		return -1;

    if (GetFirmwareVersion(chFileName, &tPackVersionInfo) != 0)
		return -1;

	printf("FirmVersion: %s\n", tPackVersionInfo.szFirmVersion);
	printf("SupportScriptVersion: %s\n", tPackVersionInfo.szSupportScriptVersion);
	printf("WebVersion: %s\n", tPackVersionInfo.szWebVersion);
	printf("ScriptVersion: %s\n", tPackVersionInfo.szScriptVersion);
	printf("ViewerPluginVersion: %s\n", tPackVersionInfo.szViewerPluginVersion);
	printf("UpgragePluginVersion: %s\n", tPackVersionInfo.szUpgragePluginVersion);
	printf("SupportedModel: %s\n", tPackVersionInfo.szSupportedModel);
	printf("Language: %s\n", tPackVersionInfo.szLanguage);

	return 0;
}

int HandleFileArgument(int argc, char* argv[])
{
	int nCnt;
	
	chFileName[0] = 0;
	for (nCnt = 1; nCnt < argc; nCnt++)
	{
		if (strncmp(argv[nCnt], "-R", 2) == 0 && strlen(argv[nCnt]) > 2)
		{
			strncpy(chFileName, &argv[nCnt][2], sizeof(chFileName));
			chFileName[sizeof(chFileName) - 1] = 0;
		}
	}
	if (chFileName[0] == 0)
	{
		printf("please input file path");
		return -1;
	}
	return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?