各位高手 帮兄弟一把 谢谢了

解决方案 »

  1.   

    void createfold(LPCTSTR shostip,LPCTSTR disk)
    {
    WSADATA wsadata;
    #define winsock_version 0x0101
    if(WSAStartup(winsock_version,&wsadata))
    AfxMessageBox("WSAStartup error");
    LPHOSTENT lphostent;
    unsigned long uladdr=inet_addr(shostip);
    lphostent=gethostbyaddr((const char*)&uladdr,4,AF_INET);
    AfxMessageBox(lphostent->h_name);
    CString filepath;
    filepath.Format("\\\\%s\\%s\\test.txt",lphostent->h_name,disk);
    CFile file;
    file.Open(filepath,CFile::modeCreate);
    file.Close();
    WSACleanup( );}
    void CC22Dlg::OnOK() 
    {
    //create a file at \\192.168.0.1\f\text.txt
    createfold("192.168.0.1","f");
    }