VF6.0与C#的转移数据

在vfp的程序中新建txt文件,将vfp评析结果放入txt

新建及删除txt文件(vfp)

  cScore='d:/score.txt'
 
  if file(cScore)
    dele file 'd:/a.txt'
    
    x=FCREATE("d:/score.txt")
     =FPUTS(x,alltrim(str(score_all)))
     =FCLOSE(x)
  else
    x=FCREATE("d:/score.txt")
     =FPUTS(x,alltrim(str(score_all)))
     =FCLOSE(x)
  

   endif

 delete file ('d:/score.txt') 

 

 

 

 

/C#执行exe文件并且读取vfp执行的结果

 static void Main(string[] args)
        {


            //将vf做的判卷系统编译为exe文件并执行
            Process proc = new Process();
            proc.StartInfo.FileName = @"C://Users/Administrator/Desktop/test.exe";   //可以用绝对路径  
            proc.StartInfo.Arguments = "";
            proc.Start();
            //proc.Kill();


            if (System.IO.File.Exists("D://score.txt"))
            {


                //C#读取分数文件
                StreamReader objReader = new StreamReader("d://score.txt");
                string sLine = "";
                ArrayList arrText = new ArrayList();

                while (sLine != null)
                {
                    sLine = objReader.ReadLine();
                    if (sLine != null)
                        arrText.Add(sLine);
                }
                objReader.Close();

 

                //将读取的结果显示
                string score = "";

                foreach (string sOutput in arrText)
                    score =score+sOutput;
                    //Console.WriteLine(sOutput);

                Console.WriteLine(score);
                //Console.ReadLine();
            }

           

        }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值