Search
 
SCRIPT & CODE EXAMPLE
 

C

myFgets in c

#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, "
")] = 0;
	strcpy(str, tempStr);
	return str;
}
Comment

PREVIOUS NEXT
Code Example
C :: purge nvidia 
C :: full installation of clang in ubuntu 
C :: conio.h linux 
C :: printf format specifiers 
C :: golang loop through array 
C :: Donut-shaped C code 
C :: octave square each element matrix 
C :: c program to find area of circle 
C :: sdl draw Rectf 
C :: how to auto run something on cmd 
C :: lerp function c 
C :: size of an array c 
C :: successeur d’un entier donné 
C :: graphics in c 
C :: nested loop in c 
C :: concatenate char * c 
C :: selection sort in c 
C :: addition in c 
C :: Graphics in C Draw A Line 
C :: c if 
C :: gcc options to find out makefiel rules 
C :: arduino wifi client 
C :: addition of two numbers in c 
C :: functions in c 
C :: c language string 
C :: how to read 2d array from a file in c 
C :: print float number completely in C language 
C :: faire une facture en langage c 
C :: adding a node in the front on a linked list 
C :: how to check the word is present in given char array in c 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =