在下面网址
http://topic.csdn.net/u/20090322/01/3AA46184-E9BE-45B9-9DA9-3C6B8829B04A.html
得到这么一段代码用VC++6.0运行,出现下面的错误,可是看不懂,望大虾指点!
using System;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;class Test
{
  // 获取网页的HTML内容
  static string GetPage(string url)
  {
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
    try
    {
      using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
      {
        using (StreamReader sr = new StreamReader(res.GetResponseStream()))
        {
          return sr.ReadToEnd();
        }
      }
    }
    catch (System.Exception e)
    {
      return e.Message;
    }
    finally
    {
      req.Abort();
    }
  }  // 通过外部网站得到本机的外部IP
  static string GetOuterIP()
  {
    string patt = @"IP: \[(?<IP>[0-9\.]*)\]";
    string url  = "http://www.skyiv.com/info";
    return Regex.Match(GetPage(url), patt).Groups["IP"].Value;
  }  static void Main()
  {
    Console.WriteLine("Inner IP:");
    foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
    {
      Console.WriteLine(ip);
    }
    Console.WriteLine();
    Console.WriteLine("Outer IP:");
    Console.WriteLine(GetOuterIP());
  }
}
--------------------Configuration: get IP  - Win32 Debug--------------------
Compiling...
get IP .c
c:\documents and settings\administrator\桌面\get ip .c(1) : error C2061: syntax error : identifier 'System'
c:\documents and settings\administrator\桌面\get ip .c(1) : error C2059: syntax error : ';'
c:\documents and settings\administrator\桌面\get ip .c(2) : error C2061: syntax error : identifier 'System'
c:\documents and settings\administrator\桌面\get ip .c(2) : error C2059: syntax error : ';'
c:\documents and settings\administrator\桌面\get ip .c(2) : error C2059: syntax error : '.'
c:\documents and settings\administrator\桌面\get ip .c(3) : error C2061: syntax error : identifier 'System'
c:\documents and settings\administrator\桌面\get ip .c(3) : error C2059: syntax error : ';'
c:\documents and settings\administrator\桌面\get ip .c(3) : error C2059: syntax error : '.'
c:\documents and settings\administrator\桌面\get ip .c(4) : error C2061: syntax error : identifier 'System'
c:\documents and settings\administrator\桌面\get ip .c(4) : error C2059: syntax error : ';'
c:\documents and settings\administrator\桌面\get ip .c(4) : error C2059: syntax error : '.'
c:\documents and settings\administrator\桌面\get ip .c(6) : error C2061: syntax error : identifier 'Test'
c:\documents and settings\administrator\桌面\get ip .c(6) : error C2059: syntax error : ';'
c:\documents and settings\administrator\桌面\get ip .c(7) : error C2449: found '{' at file scope (missing function header?)
c:\documents and settings\administrator\桌面\get ip .c(35) : error C2018: unknown character '0x40'
c:\documents and settings\administrator\桌面\get ip .c(35) : warning C4129: '[' : unrecognized character escape sequence
c:\documents and settings\administrator\桌面\get ip .c(35) : warning C4129: '.' : unrecognized character escape sequence
c:\documents and settings\administrator\桌面\get ip .c(35) : warning C4129: ']' : unrecognized character escape sequence
c:\documents and settings\administrator\桌面\get ip .c(51) : error C2059: syntax error : '}'
执行 cl.exe 时出错.get IP .obj - 1 error(s), 0 warning(s)