首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

小弟我刚菜鸟

2012-10-16 
我刚初学者用java或者C#读取ASCII或者二进制的STL文件代码怎么写啊???[解决办法]C# codepublicstaticintAs

我刚初学者
用java或者C#读取ASCII或者二进制的STL文件代码怎么写啊???

[解决办法]

C# code
public   static   int   Asc(string   character)    {      if   (character.Length   ==   1)      {        System.Text.ASCIIEncoding   asciiEncoding   =   new   System.Text.ASCIIEncoding();        int   intAsciiCode   =   (int)asciiEncoding.GetBytes(character)[0];        return   (intAsciiCode);      }      else      {        throw   new   Exception( "Character   is   not   valid. ");      }    } ASCII码转字符: public   static   string   Chr(int   asciiCode)    {      if   (asciiCode   > =   0   &&   asciiCode   <=   255)      {        System.Text.ASCIIEncoding   asciiEncoding   =   new   System.Text.ASCIIEncoding();        byte[]   byteArray   =   new   byte[]   {   (byte)asciiCode   };        string   strCharacter   =   asciiEncoding.GetString(byteArray);        return   (strCharacter);      }      else      {        throw   new   Exception( "ASCII   Code   is   not   valid. ");      }    } 

热点排行