Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 31-05-2007
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Poder: 22
cHackAll Va por buen camino
Cool Solucion

Creo que te es mas util el siguiente código... use pura API porque me gusta. Para las cadenas Unicode debes contar como un caracter si, un 0, otro si otro 0, etc, etc... para aumentar el "rango" cambia agrega contenido a la func. IsLetter.

Código Delphi [-]
function IsLetter(const Char: System.Char): LongBool;
begin
 Result := Char in ['a'..'z', 'A'..'Z', '0'..'9', ' '];
end;

const CrLf: Word = $0A0D;
var hFile, Index, Size, Dummy: Cardinal; lpBuffer: PChar;
begin
 hFile := CreateFile('c:\ntldr', GENERIC_READ, 0, nil, OPEN_EXISTING, 0, 0);
 lpBuffer := MapViewOfFile(CreateFileMapping(hFile, nil, PAGE_READONLY, 0, 0, nil), FILE_MAP_READ, 0, 0, 0);
 Size := GetFileSize(hFile, nil);
 CloseHandle(hFile);

 hFile := CreateFile('c:\ntldr.txt', GENERIC_WRITE, 0, nil, CREATE_ALWAYS, 0, 0);
 Index := 0;
 while Index < Size do
  begin
   if ((Size - Index) > 3) and
      IsLetter(lpBuffer[Index]) and
      IsLetter(lpBuffer[Index + 1]) and
      IsLetter(lpBuffer[Index + 2]) and
      IsLetter(lpBuffer[Index + 3]) then
    begin
     while (Index < Size) and IsLetter(lpBuffer[Index]) do
      begin
       WriteFile(hFile, lpBuffer[Index], 1, Dummy, nil);
       Inc(Index);
      end;
     WriteFile(hFile, CrLf, 2, Dummy, nil);
    end
   else
    Inc(Index);
  end;
 CloseHandle(hFile);
end;

Espero te sirva.
Suerte!
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Pasar ficheros de Theos a otro Formato Triton Varios 4 30-10-2007 23:03:33
ficheros binarios e imagenes sapi Varios 2 03-10-2006 16:50:34
Correo Web y Ficheros de Texto. marcoszorrilla Varios 29 06-09-2006 22:51:55
Leer enteros de 32-bits en ficheros binarios elcaracas C++ Builder 2 08-04-2005 21:46:54
Ficheros binarios deimonio Varios 2 29-12-2003 13:38:47


La franja horaria es GMT +2. Ahora son las 18:17:21.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi