Well, here's a lousy solution to a lousy problem : (please don't crucify my code since I know it's not depurated)
---------------------------------------------------------------------------- ------- $archivo = fopen("./registrados.txt", "a+"); if ($archivo) { $posicion = fseek($archivo, -512, SEEK_END); $datos = fread($archivo, 7); $entero = intval(substr($datos, 2, 5)); If (empty($entero) || !is_int($entero)) { $entero = 1000; } $entero++; $socio = str_repeat("0", 5 - strlen(strval($entero))).strval($entero); $linea = "\n\"$socio\";\"$fecha\";\"$nombre $apellido\";\"$rut\";\"$fono\";\"$direccion\";\"$comuna\";\"$ciudad\";\"$pai s\";\"$edad\";\"$email\";\"$select_familiares\";\"$select_lugar_compra\";\"$ cocina\";\"$select_personas_cocinan\";\"$recetario\""; $linea = $linea . str_repeat(" ", 512 - strlen($linea)); fseek($archivo, 0, SEEK_END); fwrite ($archivo, $linea, 512); fclose($archivo); ---------------------------------------------------------------------------- --------- It does works... sounds amazing after this hours... helps everybody, you are fine people !!! "Miguel Cruz" <[EMAIL PROTECTED]> escribió en el mensaje [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, 21 Mar 2002, Mauricio Sthandier wrote: > > I could append but then I need to read the first 8 chars of the last line I > > appended... neither something I know how to do. > > Seek to the end of the file minus typical record length, read, > look for the penultimate end-of-record delimiter (\n, probably) in there, > and you've found your final record. If you don't find a delimiter, read > some more and tack it onto the beginning of your string, then check again. > Repeat until batter contains no large lumps. > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php