diff options
Diffstat (limited to 'cpukit/libmisc/shell/write_file.c')
-rw-r--r-- | cpukit/libmisc/shell/write_file.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cpukit/libmisc/shell/write_file.c b/cpukit/libmisc/shell/write_file.c new file mode 100644 index 0000000000..f9e72f4645 --- /dev/null +++ b/cpukit/libmisc/shell/write_file.c @@ -0,0 +1,43 @@ +/* + * + * Write buffer to a file + * + * Author: + * + * WORK: fernando.ruiz@ctv.es + * HOME: correo@fernando-ruiz.com + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <unistd.h> +#include <string.h> + +void rtems_shell_write_file( + const char *name, + const char *content +) +{ + FILE * fd; + + fd = fopen(name,"w"); + if ( !fd ) { + fprintf( stderr, "Unable to write %s\n", name ); + } + + if (fd) { + fwrite(content,1,strlen(content),fd); + fclose(fd); + } +} + + |