source: rtems/cpukit/libmisc/shell/write_file.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 685 bytes
Line 
1/*
2 *
3 *  Write buffer to a file
4 *
5 *  Author:
6 *
7 *   WORK: fernando.ruiz@ctv.es
8 *   HOME: correo@fernando-ruiz.com
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <stdio.h>
20#include <unistd.h>
21#include <string.h>
22
23#include <rtems/shell.h>
24
25void rtems_shell_write_file(
26  const char *name,
27  const char *content
28)
29{
30  FILE * fd;
31
32  fd = fopen(name,"w");
33  if ( !fd ) {
34    fprintf( stderr, "Unable to write %s\n", name );
35  }
36
37  if (fd) {
38    fwrite(content,1,strlen(content),fd);
39    fclose(fd);
40  }
41}
42
43
Note: See TracBrowser for help on using the repository browser.