Search
lxdream.org :: lxdream/src/util.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/util.c
changeset 17:944f75eea496
next31:495e480360d7
author nkeynes
date Thu Dec 22 07:38:12 2005 +0000 (16 years ago)
permissions -rw-r--r--
last change Implement 95% of the SCIF serial interface
Implement basic load_bin_file function to try to load demos directly
Update TMU to run all 3 timers, start on general timing
view annotate diff log raw
     1 #include "dream.h"
     2 #include "modules.h"
     4 void fwrite_string( char *s, FILE *f )
     5 {
     6     uint32_t len = 0;
     7     if( s == NULL ) {
     8 	fwrite( &len, sizeof(len), 1, f );
     9     } else {
    10 	len = strlen(s)+1;
    11 	fwrite( &len, sizeof(len), 1, f );
    12 	fwrite( s, len, 1, f );
    13     }
    14 }
    16 int fread_string( char *s, int maxlen, FILE *f ) 
    17 {
    18     uint32_t len;
    19     fread( &len, sizeof(len), 1, f );
    20     if( len != 0 ) {
    21 	fread( s, len > maxlen ? maxlen : len, 1, f );
    22     }
    23     return len;
    24 }
.