MyFgets In C

[Solved] MyFgets In C | C - Code Explorer | yomemimo.com
Question : myFgets in c

Answered by : proud-platypus-fnf10txxob8w

#include <stdlib.h>
#include <string.h>
char* myFgets();
/*	this function is better version of fgets input: NONE output: pointer to the first char in the str
*/
char* myFgets()
{	char tempStr[BIG_NUM] = { 0 };	char* str = NULL;	fgets(tempStr, BIG_NUM, stdin);	str = (char*)malloc(sizeof(char) * strlen(tempStr));	tempStr[strcspn(tempStr, "\n")] = 0;	strcpy(str, tempStr);	return str;
}

Source : | Last Update : Fri, 11 Feb 22

Answers related to myFgets in c

Code Explorer Popular Question For C