我写了一个新类,代码如下:
#include "stdafx.h"
#include "textprinter.h"
#include <assert.h>
   CTextPrinter::CTextPrinter()
   {m_hCom=NULL;
    FPrinterOpen=FALSE;
   }
   CTextPrinter::
    CTextPrinter::~CTextPrinter()
{
}
void CTextPrinter::Create()
{//HANDLE m_hCom;
 //BOLL FPrinterOpen=FALSE;
m_hCom=CreateFile(m_sPort, GENERIC_READ | GENERIC_WRITE, 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); // 以重叠方式打开串口
    if(m_hCom==INVALID_HANDLE_VALUE)
    {   
        AfxMessageBox("设置串口部分,串口打开失败");   /////重叠方式 异步通信(INVALID_HANDLE_VALUE)函数失败。
        return 0;
    } 
 FPrinterOpen=TRUE;
      return 1;
}     void CTextPrinter::write(int strwt)
 {int *Outbuff;
      static OVERLAPPED ol;
      DWORD nBytesWrite;
  //int size=strwt.GetLenth();
  outuff=&strwt;
 if(!WriteFile(m_hCom,Outbuff,1,&nBytesWrite,&ol)) 
 {   
        AfxMessageBox("数据发送错误");   
        return 0;
 } 
 return 1;  }
void CTextPrinter::WriteLn(const CString   strwl);
void CTextPrinter::Destroy()
    {if(!CloseHandle(m_hCom));
{   
        AfxMessageBox("并口关闭错误");   
        return 0;
 } 
 return 1;
}
    编译错误提示:
Compiling...
textprinter.cpp
d:\program files\microsoft visual studio\vc98\include\assert.h(57) : error C2143: syntax error : missing ';' before 'string'
d:\program files\microsoft visual studio\vc98\include\assert.h(57) : fatal error C1004: unexpected end of file found
Error executing cl.exe.textprinter.obj - 2 error(s), 0 warning(s)
我在网上找了很多资料,但没有找到能解决这个问题的,所以请各位多多指教,谢谢!