Example #1
0
        public static void filtro()
        {
            FileStream infile, outfile;
            int        tam;
            char       x;

            infile = new System.IO.FileStream(ProgramaFonte.getPathNome(),
                                              System.IO.FileMode.Open,
                                              System.IO.FileAccess.Read);
            outfile = new System.IO.FileStream("pftmp.txt",
                                               System.IO.FileMode.Create,
                                               System.IO.FileAccess.Write);

            tam = (int)infile.Length;
            for (int i = 0; i < tam; ++i)
            {
                x = (char)infile.ReadByte();
                if (x == '#')
                {
                    ++i;
                    do
                    {
                        x = (char)infile.ReadByte();
                        ++i;
                    }while (x != '#');
                }
                else
                if (x != ' ')
                {
                    outfile.WriteByte((byte)char.ToUpper(x));
                }
            }
            infile.Close();
            outfile.Close();
        }
 private void compilarProgramaToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProgramaFonte.setPathNome(openFileDialog1.FileName);
     MeuCompiladorBLL.compilarPrograma();
     if (Erro.getErro())
     {
         MessageBox.Show(Erro.getMsg());
     }
     else
     {
         MessageBox.Show("Programa Compilado com sucesso!!!");
     }
 }