stream.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 41 行

C
41
字号
/*
 *
 *   BSD sockets functionality for Waterloo TCP/IP
 *
 *   Version
 *
 *   0.5 : Dec 18, 1997 : G. Vanem - created
 */

#include "socket.h"

#if defined(USE_BSD_FUNC)

/*
 *  How does this fit in with djgpp's FSextensions ?
 *  Does it support fdopen() ?
 */

int sock_fgets (char *buf, int max, FILE *stream)
{
  int     s    = fileno (stream);
  Socket *sock = _socklist_find (s);

  SOCK_PROLOGUE (sock, "\nsock_fgets:%d", s);

  /* !!to-do: this should read a single line only (use sock_gets?)
   */
  return read_s (s, buf, max);  
}

int sock_fputs (char *text, FILE *stream)
{
  int     s    = fileno (stream);
  Socket *sock = _socklist_find (s);

  SOCK_PROLOGUE (sock, "\nsock_fputs:%d", s);
  return write_s (s, text, strlen(text));
}

#endif  /* USE_BSD_FUNC */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?