public static void leIndice() { OleDbDataReader resultInd; String aux = "select * from TIndLib where codigo =" + Token.getCodigo(); strSQL = new OleDbCommand(aux, conn); resultInd = strSQL.ExecuteReader(); Erro.setErro(false); if (resultInd.Read()) { IndLib.setInicio("" + resultInd.GetInt32(1)); IndLib.setTamanho("" + resultInd.GetInt32(2)); } }
public static void gravaArquivo() { FileStream infile, outfile; int tam; char x; infile = new System.IO.FileStream("pontocom.lib", System.IO.FileMode.Open, System.IO.FileAccess.Read); outfile = new System.IO.FileStream("programa.com", System.IO.FileMode.Append, System.IO.FileAccess.Write); MeuCompiladorDAL.leIndice(); tam = int.Parse(IndLib.getTamanho()); infile.Position = int.Parse(IndLib.getInicio()); for (int i = 0; i < tam; ++i) { x = (char)infile.ReadByte(); outfile.WriteByte((byte)x); } infile.Close(); outfile.Close(); }