ushort Flibhndl = 0; short ret; // 返回值 // 获取库句柄 ( Ethernet ) ret = Focas1.cnc_allclibhndl3("192.168.0.224", 8193, 10, out Flibhndl); if (ret != Focas1.EW_OK) { Console.WriteLine("发生异常,请检查!"); return; } #region cnc_upload4 string str = ""; string prgname = Console.ReadLine(); byte[] buf = new byte[1280]; // String of CNC program int len ; ret = Focas1.cnc_upstart4(Flibhndl, 0, prgname);//"//CNC_MEM/USER/PATH1/prgname" if (ret != Focas1.EW_OK) return ; do { len = 1280 ; do { ret = Focas1.cnc_upload4(Flibhndl, ref len, buf); } while (ret == 10); if ( ret == Focas1.EW_OK ) { for (int idx = 0; idx < len; idx++) str +=Convert.ToString(Convert.ToChar(buf[idx])); } if ( buf[len-1] == '%' ) { break ; } } while ( ret == Focas1.EW_OK ) ; ret = Focas1.cnc_upend4(Flibhndl); Console.WriteLine(str); #endregion}}
请把你的代码格式化一下,点击“代码段”图标插入代码。
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632