12345678910111213141516171819202122232425262728293031323334353637 |
- """Generic utilities for C++ parsing."""
- import sys
- DEBUG = True
- def ReadFile(filename, print_error=True):
- """Returns the contents of a file."""
- try:
- fp = open(filename)
- try:
- return fp.read()
- finally:
- fp.close()
- except IOError:
- if print_error:
- print('Error reading %s: %s' % (filename, sys.exc_info()[1]))
- return None
|