X-Git-Url: https://git.llucax.com/z.facultad/75.43/tp1.git/blobdiff_plain/9e86839e74733b8e67b56a5652aff670bf035ef2..750098581a29b1729bb94fe63d0cd576249e62fe:/src/lib/file.php?ds=inline diff --git a/src/lib/file.php b/src/lib/file.php index 4b96769..2e3b403 100644 --- a/src/lib/file.php +++ b/src/lib/file.php @@ -30,6 +30,19 @@ if (!function_exists('fputcsv')) { } } +/** + * Agrega una entrada al final de un archivo csv. + * + * @return bool false si hay error. + */ +function fappendcsv($filename, $fields, $delim = ',') +{ + if (($f = fopen($filename, 'a')) === false) return false; // error + fputcsv($f, $fields, $delim); + fclose($f); + return true; +} + /** * Obtiene un archivo csv como array de arrays * @@ -52,7 +65,7 @@ function fgetallcsv($filename, $delim = ',') */ function fsearchcsv($filename, $what, $id = 0, $delim = ',') { - if (($f = fopen($filename, 'r')) === false) return false; + if (($f = fopen($filename, 'r')) === false) return false; while (!feof($f)) { $d = fgetcsv($f, 4096);