扫描枪程序-扫描枪扫码,保存数据并在当前目录生成文档

琢磨半天,原来就这么简单。

等待扫描枪扫码,保存数据并在当前目录生成文档

 

// scan.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
 #pragma warning(disable:4996)
#include "string.h"
#include "stdlib.h"
int main()
{
	 char pchData[_MAX_PATH];
	//char str[_MAX_PATH];
	 printf("Waiting for the scan data:");
	scanf("%s", pchData);

	//printf("%s", pchData);

	FILE *pFile = fopen("scan.txt", "w+t");
	if (pFile)
	{
	 
		fwrite(pchData, sizeof(char), strlen(pchData), pFile);
		fclose(pFile);
	}
    return 0;
}

你可能感兴趣的:(MFC/C++)