2 simple-file-storage.cc -- implement Simple_file_storage
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
11 #include "file-storage.hh"
17 Stupid but foolproof way of opening files.
20 Should use obstack. Should check IO status
22 This is of course a build it yourself version of mmap, so we should
23 have been using that... (see Mapped_file_storage) But we noticed
24 some problems with this (unexplained lexer crashes)
28 Simple_file_storage::Simple_file_storage(String s)
31 FILE * f = fopen ( s.ch_C(), "r");
33 warning("can't open file\n");
37 int ret = fseek( f, 0, SEEK_END);
40 data_p_ = new char[len_i_+1];
42 ret = fread(data_p_, sizeof(char), len_i_, f);
48 Simple_file_storage::ch_C() const
54 Simple_file_storage::length_i()const
60 Simple_file_storage::~Simple_file_storage()