Metropoli BBS
VIEWER: strread.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1996 by Thomas Glen Smith.  All Rights Reserved.*/
/* strread APL2 V1.0.0 *************************************************
* Called to read a character string during a )load operation.          *
***********************************************************************/
#define INCLUDES APLMEM+STRING+IO+STDIO
#include "includes.h"
char *strread(fp)
int fp; /* file handle */
{
	int i,j;
	char *cp;

	i = read(fp, &j, sizeof(int)); /* j = length of string */
	if (j == 0 ||
		NULL == (cp = malloc(j)))
		return(NULL); /* out of memory */
	i = read(fp, cp, j);
	return(cp);
}
[ RETURN TO DIRECTORY ]