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();
            }

           

        }

你可能感兴趣的:(VF6.0与C#的转移数据)