X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Flib_head.c;h=0f080bcaae4c227258b3c080513cbb9db08545ed;hb=c892d64b10ea3ac2fc72761009ae35cb9af5e6e5;hp=e9004d5e508d27a7a120a122f0e44a9132dff239;hpb=56bb29bded61d906400612e14b81f2d5f34b7600;p=16.git diff --git a/src/lib/lib_head.c b/src/lib/lib_head.c index e9004d5e..0f080bca 100644 --- a/src/lib/lib_head.c +++ b/src/lib/lib_head.c @@ -1,9 +1,32 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + #include "src/lib/lib_head.h" /* local function */ void wait(clock_t wait); void* AllocateLargestFreeBlock(size_t* Size); -size_t GetFreeSize(void); +size_t GetFreeSize(void); +long int filesize(FILE *fp); /* Function: Wait ********************************************************** * @@ -93,3 +116,15 @@ size_t GetFreeSize(void) return total; } + +long int +filesize(FILE *fp) +{ + long int save_pos, size_of_file; + + save_pos = ftell(fp); + fseek(fp, 0L, SEEK_END); + size_of_file = ftell(fp); + fseek(fp, save_pos, SEEK_SET); + return(size_of_file); +}