Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2352720
  • 博文数量: 816
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 5010
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-17 17:57
文章分类

全部博文(816)

文章存档

2011年(1)

2008年(815)

分类:

2008-12-17 18:05:33

以下是我在微软官方看到的事例程序 为什么我编译时总是出错呢
我用的是VC++ 6.0
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
D:\My Documents\Cpp1.cpp(33) : error C2065: 'GetVolumeNameForVolumeMountPoint' : undeclared identifier
D:\My Documents\Cpp1.cpp(46) : error C2065: 'SetVolumeMountPoint' : undeclared identifier
执行 cl.exe 时出错.

Cpp1.obj - 1 error(s), 0 warning(s)
-------------------------------------------------------------------------


#define _WIN32_WINNT 0x0501

#include
#include

#define BUFSIZE MAX_PATH


void Syntax (char *argv)
{

   printf( "%s, mount a volume at a mount point.\n", argv );
   printf( "For example, \"mount c:\\ f:\\\"\n" );
}

int
main( int argc, char *argv[] )
{
   BOOL bFlag;
   char Buf[BUFSIZE];     // temporary buffer for volume name

   if( argc != 3 )
   {
      Syntax( argv[0] );
      return( -1 );
   }

  // We should do some error checking on the inputs. Make sure
  // there are colons and backslashes in the right places, etc.

   bFlag = GetVolumeNameForVolumeMountPoint(
              argv[2], // input volume mount point or directory
                  Buf, // output volume name buffer
               BUFSIZE // size of volume name buffer
           );

   if (bFlag != TRUE)
   {
      printf( "Retrieving volume name for %s failed.\n", argv[2] );
      return (-2);
   }

   printf( "Volume name of %s is %s\n", argv[2], Buf );
   bFlag = SetVolumeMountPoint(
              argv[1], // mount point
                   Buf // volume to be mounted
           );

   if (!bFlag)
     printf ("Attempt to mount %s at %s failed.\n", argv[2], argv[1]);

   return (bFlag);
}

--------------------next---------------------

阅读(1121) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~