02-11-2008
Quote:
Originally Posted by
h@run
also: using itoa() produces a " warning: implicit declaration of function 'itoa' " even though i have #included stdlib.h
This is because itoa is not an ANSI C function (though its converse function, atoi, does) so its prototype is not in the stdlib.h header file as you would expect. Probably it is even not supported by your environment. jim mcnamara showed us the portable way one can format an integer into a string using the ANSI sprintf function (check also its secure version, snprintf).
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi, im trying to compare two variables in csh to put in an if statement, eg:
set a = $firstnum
set b = $secondnum
if ($a -ge $b) echo $a
But I get an error ("if: Expression syntax"). How can I make csh see my variables as integers?
thanks in advance! (5 Replies)
Discussion started by: Deanne
5 Replies
2. Shell Programming and Scripting
I have a file with the following:
87565
82155
102656
151
162
I want to write korn shell script that will read each line in a loop and remove any number that has less than 5 digits, e.g., 151 and 152.
thank you,
Keoki:confused: (4 Replies)
Discussion started by: keoki_mel
4 Replies
3. Shell Programming and Scripting
I would like to add 4.7 and 1.2. However I am unable to do this with expr.
Any simple ideas (even using something other than expr)?
Example:
me> expr 4 + 1
5
me> expr 4.7 + 1.2
expr: 0402-046 A specified operator requires numeric parameters. (18 Replies)
Discussion started by: 2dumb
18 Replies
4. Shell Programming and Scripting
I am using gawk in a dos shell in windows xp and want to read a datafile and reformat it.
The datafile consists of columns of integers, floating point numbers and text strings. Each column is a fixed width and each column contains the same data type, eg all integers, all text.
I am looking for a... (0 Replies)
Discussion started by: lookingfor help
0 Replies
5. IP Networking
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies
6. Shell Programming and Scripting
Wonderful evening to all of you!
My problem has to possible starting points.
Well, not really, but getting to either one is no problem at all.
So i got either a string in the format of "1920x1080" or simply the integers X = 1920 and Y = 1080.
When I am done, I would like to have an output... (5 Replies)
Discussion started by: jakunar
5 Replies
7. Shell Programming and Scripting
Hi,
I am working in bash in Mac OSX, I have following 'input.txt' file:
<INFO> HypoTestTool: >>> Done running HypoTestInverter on the workspace combined
<INFO> HypoTestTool: The computed upper limit is: 11 +/- 1.02651
<INFO> HypoTestTool: expected limit (median) 11
<INFO> HypoTestTool: ... (13 Replies)
Discussion started by: Asif Siddique
13 Replies
8. Shell Programming and Scripting
Hy friends, I am newbie to bash scripting, can anyone explain how b=${a/23/BB} # Substitute "BB" for "23". this line converts "b" into string and and "d" into Integer. Thanks in advance (4 Replies)
Discussion started by: Qazi
4 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I'm totally new at this, so help will be appreciated.
I have a directory with a bunch of files in it. The files are named xinteger_yinteger_zinteger.vtk (eg, x3_y0_z-1.vtk). I want to read the filenames and then assign the integers to variables that I then can use in expressions. So, for... (6 Replies)
Discussion started by: jhsinger
6 Replies
10. Shell Programming and Scripting
Hi,
I can't figure out what I'm missing. I'm running a query to see if there are any streams recording on my DVR before starting a scripted update. I'm guessing that it is viewing $VIDEO as a string instead of an int. I've tried everything I saw on google but it still comes back as $VIDEO is... (8 Replies)
Discussion started by: Rhysers
8 Replies
LEARN ABOUT NETBSD
stdlib
STDLIB(3) BSD Library Functions Manual STDLIB(3)
NAME
stdlib -- standard library definitions
SYNOPSIS
#include <stdlib.h>
DESCRIPTION
The <stdlib.h> header defines the following types and macros:
1. NULL - an implementation-defined null pointer constant;
2. size_t and wchar_t - integer types described in stddef(3);
3. div_t, ldiv_t, and lldiv_t - structures that are returned by the div(3), ldiv(3), and lldiv(3) functions, respectively;
4. RAND_MAX - a macro which expands to an integer constant that is the maximum value returned by the rand(3) function;
5. MB_CUR_MAX - an integer expression of type size_t whose value is the maximum number of bytes in a character specified by the current
locale; and
6. EXIT_SUCCESS and EXIT_FAILURE - macros which expand to integer constants suitable for use as an argument to the exit(3) function.
The <stdlib.h> header also prototypes several important functions such as abort(3), atoi(3), bsearch(3), free(3), malloc(3), and strtol(3).
SEE ALSO
stddef(3), types(3), unistd(3)
STANDARDS
As described here, the <stdlib.h> header conforms to ISO/IEC 9899:1999 (``ISO C99'') and IEEE Std 1003.1-2001 (``POSIX.1'').
HISTORY
In the current form the <stdlib.h> header was introduced in NetBSD 0.8.
BSD
April 10, 2011 BSD