view demo/demo_util.h @ 9:477c36226481 tip

added old scripts for historical interest.
author Robert McIntyre <rlm@mit.edu>
date Fri, 21 Oct 2011 07:46:18 -0700
parents e38dacceb958
children
line wrap: on
line source
1 /* General-purpose utilities used by demos */
3 /* snes_spc 0.9.0 */
4 #ifndef DEMO_UTIL_H
5 #define DEMO_UTIL_H
7 /* commonly used headers */
8 #include <assert.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <stdio.h>
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
17 /* If str is not NULL, prints it and exits program, otherwise returns */
18 void error( const char* str );
20 /* Loads file and returns pointer to data in memory, allocated with malloc().
21 If size_out != NULL, sets *size_out to size of data. */
22 unsigned char* load_file( const char* path, long* size_out );
24 /* Writes data to file */
25 void write_file( const char* path, void const* in, long size );
27 #ifdef __cplusplus
28 }
29 #endif
31 #endif