Wednesday, July 11, 2012

Keyword imp on UNIX(alarm,strtol)

The alarm API function can be very useful to time out other functions. The alarm function works by raising a SIGALARM signal once the number of seconds passed to alarm has expired. The function prototype for the alarm is :

**unsigned int alarm ( unsigned int secs);

------------------------------------------------------------------------------------------------------------------------------------
convert string to long integer .

This function first discards as many whitespace characters as neccessary until the first non -whitespace character is found.
Finally a pointer to the first character following the interger representation in *str is stored in the object pointed by **endptr.

*** long int strtol ( const char * str, char ** endptr, int base );

parameters are:

str--- string that contain value like(hexadecimal, ocatadecimal, binary etc..)

endptr-- Reference to an object of type char*, whose value is set by the function to the next character in str after the numerical value.
This parameter can also be a null pointer, in which case it is not used.

base-- it is either 10,2,8 etc..

No comments:

Post a Comment

Qualcomm Short Term

  113 is the SL. 1st Target by mid July.

Total Pageviews