want to read data from serial port and save the data to file using 'attach'

解决方案 »

  1.   

    You could read data from serial port by using CSerialPort class.
    And saving the data to file by using CFile class.
    You could get the CSerialPort class from www.codeproject.com
      

  2.   

    HANDLE CreateFile(LPCTSTR lpFileName, ...); lpFileName 
    [in] Pointer to a null-terminated string that specifies the name of the object (file, communications resource, disk device, console, or directory) to create or open. 
    If *lpFileName is a path, there is a default string size limit of MAX_PATH characters. This limit is related to how the CreateFile function parses paths. When lpFileName points to a communications resource to open, you must include a colon after the name. For example, specify "COM1: " to open that port. When using IrCOMM, specify "COM3:".