Si sólo es un simple listín telefónico sería desaprobechar recursos una db, ¿no?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCitar
Leyendo desde un archivo usando BufferedStream
using System;
using System.Text;
using System.IO;
static void Main(string[] args)
{
string path = "c:\\sample\\sample.xml";
Stream instream = File.OpenRead(path);
// crear buffer para abrir stream
BufferedStream bufin = new BufferedStream(instream);
byte[] bytes = new byte[128];
// leer los primeros 128 bytes del archivo
bufin.Read(bytes, 0, 128);
Console.WriteLine("Allocated bytes: "+Encoding.ASCII.GetString(bytes));
}
Leyendo desde un archivo de texto
using System;
using System.IO;
static void Main(string[] args)
{
string fileName = "temp.txt";
FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(stream);
while (reader.Peek() > -1) Console.WriteLine(reader.ReadLine());
reader.Close();
}
Escribiendo en un archive de texto
using System;
using System.IO;
static void Main(string[] args)
{
string fileName = "temp.txt";
FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter writer = new StreamWriter(stream);
writer.WriteLine("Esta es la primera línea del archivo.");
writer.Close();
}
Creando un archivo y escribiendo en este
Este ejemplo usa el método CreateText() el cual crea un Nuevo archive y retorna un objeto StreamWriter que escribe a un archivo usando formato UTF-8.
using System;
using System.IO;
static void Main(string[] args)
{
string fileName = "temp.txt";
StreamWriter writer = File.CreateText(fileName);
writer.WriteLine("Este es mi Nuevo archivo creado.");
writer.Close();
}
Insertando texto en un archivo
using System;
using System.IO;
static void Main(string[] args)
{
try
{
string fileName = "temp.txt";
// esto inserta texto en un archivo existente, si el archivo no existe lo crea
StreamWriter writer = File.AppendText(fileName);
writer.WriteLine("Este es el texto adicionado.");
writer.Close();
}
catch
{
Console.WriteLine("Error");
}
}
Dim año as long
Dim uva as fruit
año=long(año+1)
uva=1
do while uva <=12
system.eatonefruit(uva)
uva=fruit(uva+1)
loop
<tr>
<td width="100" valign="top"><b>Dirección IP</b></td>
<td>: 25819.E5687.W2798.5TH67.00021</td>
</tr>
<tr>
<td width="100" valign="top"><b>Pais</b></td>
<td>: Tierra de Lockyer</td>
</tr>
<tr>
<td width="100" valign="top"><b>Código de área</b></td>
<td>: Z8801</td>
</tr>
<tr>
<td width="100" valign="top"><b>Región</b></td>
<td>: Los valles rojos</td>
</tr>
<tr>
<td width="100" valign="top"><b>Ciudad</b></td>
<td>: Valle Huaerte</td>
</tr>
<tr>
<td width="100" valign="top"><b>Código ZIP</b></td>
<td>: 10-087998571</td>
</tr>
Cita de: d4n0n3 en 6 Diciembre 2009, 18:24 PM# include <iostream>
using namespace std;
int main()
{
int edad=0;
cout << "MI NACIMIENTO Y..."<<endl;
for (edad=0;edad<21;edad++)
{
cout <<"CUMPLEANOS"<<endl;
}
cout <<"Hasta ahora que tengooo: " << edad << endl;
cout << "jejejeje os a gustado ehh"<<endl;
system("pause");
}
Function getedad()
Dim edad as int
Dim tmp as int
Dim startyear as long
edad=0
startyear=1984
tmp=cint(2009-startyear)
do while edad<=tmp
edad=cint(edad+1)
startyear=startyear+1
Console.writeline("Felicidades es el año "&cstr(startyear)& " y cumples "&cstr(edad))
loop
Console.writeline("mi edad actual es de "&cstr(edad)&" años")
getedad=cint(edad)
exit function
end function