Parent Directory | Revision Log | Patch
revision 131 by torben, Sun Nov 2 20:14:20 2008 UTC | revision 132 by torben, Sun Dec 7 00:59:05 2008 UTC | |
---|---|---|
# | Line 344 namespace Util | Line 344 namespace Util |
344 | return (pclose(p)); | return (pclose(p)); |
345 | } | } |
346 | ||
347 | string readfile(string filename) | |
348 | { | |
349 | string str; | |
350 | ifstream in(filename.c_str()); | |
351 | if (in) | |
352 | { | |
353 | char buffer[2048]; | |
354 | in.read(buffer, 2047); | |
355 | buffer[ in.gcount() ] = 0; | |
356 | str = string(buffer); | |
357 | in.close(); | |
358 | } | |
359 | else | |
360 | { | |
361 | string message = "Could no open "; | |
362 | message += filename; | |
363 | throw std::runtime_error(message); | |
364 | } | |
365 | return str; | |
366 | } | |
367 | ||
368 | ||
369 | ||
370 | } | } |
371 | ||
372 |
|
ViewVC Help | |
Powered by ViewVC 1.1.20 |