elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 [82]
811  Programación / .NET (C#, VB.NET, ASP) / Re: Modificar el contenido de una linea de un archivo de texto en c# en: 6 Enero 2010, 17:24 pm
Si sólo es un simple listín telefónico sería desaprobechar recursos una db, ¿no?
812  Programación / .NET (C#, VB.NET, ASP) / Re: Modificar el contenido de una linea de un archivo de texto en c# en: 6 Enero 2010, 15:54 pm
Esto lo cito de http://www.elguille.info/colabora/NET2005/svalsse_leyendo_y_escribiendo_archivos.htm :

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");
    }
}
813  Foros Generales / Foro Libre / Re: Feliz año nuevo 2010 en: 31 Diciembre 2009, 16:37 pm
Código:
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
814  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Curiosidad divertida del "localizador de IPs de elhacker.net" en: 10 Diciembre 2009, 09:07 am
en el source pone esto después del script para poner el punto:

Código:
<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>


Misterio resuelto  ;)

Jeje, más curiosidades, introduces esto: 25819.E5687.W2798.5TH67.00021 y te dice esto:

Dirección IP     : 217.125.24.22
Pais    : Spain
Código de área    : 56
Región    : Catalonia
Ciudad    : Rubí
Reverse DNS    : 22.Red-217-125-24.staticIP.rima-tde.net
Direcciones IP a las que resuelve el Host    : 217.125.24.22

Provad tambien estos:
0.0.0.0
255.255.255.255
815  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Curiosidad divertida del "localizador de IPs de elhacker.net" en: 10 Diciembre 2009, 08:52 am
¿eso es la luna o la tierra? ¿acaso los extraterrestres entran a elhacker.net desde la ip 25819.E5687.W2798.5TH67.00021? y otra cosa, esta dirección no es ipv6... será ip v8??   :o
816  Foros Generales / Foro Libre / Re: ¿Quien es vuestro usuario favorito del Foro de elhacker.net? en: 10 Diciembre 2009, 07:57 am
Mi favorito es...

Nuestro amigo el guardiacivil...





No, en serio, creo que randomize ha sido de los que más me ha ayudado, hay mas, pero no recuerdo el nombre.
817  Foros Generales / Foro Libre / Re: Edad Promedio de Usuarios del Foro. en: 10 Diciembre 2009, 07:15 am
jeje, a ver quien se atreve a hacerlo en assembler  ;-)
818  Foros Generales / Foro Libre / Re: Edad Promedio de Usuarios del Foro. en: 10 Diciembre 2009, 05:44 am
Código
  1. # include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int edad=0;                  
  8. cout << "MI NACIMIENTO Y..."<<endl;
  9.  
  10. for (edad=0;edad<21;edad++)
  11.  {
  12.  cout <<"CUMPLEANOS"<<endl;      
  13.  }
  14. cout <<"Hasta ahora que tengooo: " << edad << endl;
  15. cout << "jejejeje os a gustado ehh"<<endl;
  16. system("pause");  
  17. }

Código
  1.  
  2. Function getedad()
  3. Dim edad as int
  4. Dim tmp as int
  5. Dim startyear as long
  6.    edad=0
  7.    startyear=1984
  8.    tmp=cint(2009-startyear)
  9.  
  10. do while edad<=tmp
  11.    edad=cint(edad+1)
  12.    startyear=startyear+1
  13.    Console.writeline("Felicidades es el año "&cstr(startyear)& " y cumples "&cstr(edad))
  14. loop
  15.  
  16.   Console.writeline("mi edad actual es de "&cstr(edad)&" años")
  17.   getedad=cint(edad)
  18.   exit function
  19. end function
  20.  

a mi se me da mejor el visualbasic xDDDDD
Páginas: 1 ... 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 [82]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines