1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
   |  
// PCITest.cpp : Defines the entry point for the console application.
//
 
#include <fstream.h>
#include "stdafx.h"
#include "PCITest.h"
 
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
 
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
 
CWinApp theApp;
 
using namespace std;
 
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
	int nRetCode = 0;
	ifstream *f;
	char deviceName[60];
	do
	{
		strcpy(deviceName,"\\\\.\\");
		char name[15];
		cout << "Enter device name: ";
		cin.getline(name,sizeof(name));
		strcat(deviceName,name);
		f = new ifstream(deviceName);
		if (f==NULL || f->is_open()==false) cout << "\nUnable to open device \"" << deviceName << "\"" << endl;
	}
	while (f==NULL || f->is_open()==false);
 
	return nRetCode;
} | 
Partager