Sponsored Content
Top Forums Programming to compare two integer values stored in char pointers Post 302265275 by Franklin52 on Saturday 6th of December 2008 09:36:51 AM
Old 12-06-2008
Have you tried the atoi() function?

Regards
 

10 More Discussions You Might Find Interesting

1. Programming

C snipet on char Pointers

I have small Dout. please respond. char *p; p=" I am a Very good boy"; Is this valid or not? If not valid why is it so? It is not giving any compilation error. Thanks Vinod (3 Replies)
Discussion started by: gandhevinod
3 Replies

2. Shell Programming and Scripting

Compare integer value with decimal

Hi all, I have a issue... Is it possible to compare integer value with decimal value. If it is not possible,then how can i compare 2 decimal values in born shell.thanks! (3 Replies)
Discussion started by: MARY76
3 Replies

3. UNIX for Advanced & Expert Users

test the string is char or integer

How will test the string contains numeric character or alphabet, is there any script to test ? (10 Replies)
Discussion started by: rajesh08
10 Replies

4. Shell Programming and Scripting

how to compare string & integer in unix

Hi All, i am doung sup up of amount column in my file. tot_val=`awk '{a+=$0}END{printf "%.5f\n",a}' amount` then i have a checksum in footer. chk_sum=`tail -1 $FILE_NAME | cut -d~ -f7 | cut -c2-` but the problem is while executing 1st command i am getting : 27720.75000 & while... (3 Replies)
Discussion started by: Amit.Sagpariya
3 Replies

5. Shell Programming and Scripting

Compare two files based on integer part only

Please see how can I do this: File A (three columns): X1,Y1,1.01 X2,Y2,2.02 X3,Y3,4.03 File B (three columns): X1,Y1,1 X2,Y2,2 X3,Y3,4.0005 Now I have to compare file A and B based on the integer part of column 3. Means first 2 rows should be OK and the third row should not satisfy... (12 Replies)
Discussion started by: yale_work
12 Replies

6. UNIX for Dummies Questions & Answers

compare decimal and integer values in if in bash shell

i need to do camparisions like the below. For the case when first=10 and second=9.9 the scripts displays process failed. I need to be able to convert the values to integer before doing the comparision. Like 9.9 should be rounded over to 10 before doing comparision. Please advice how can... (3 Replies)
Discussion started by: nehagupta
3 Replies

7. Programming

I don't know how to replace input char with appropriate integer

Hi guys, I asked for help on programming forums and no one didn't helped me so I ask for help here. I am playing with some tasks from my book and I can't figure where did I get wrong. From the first program I get a blank screen, program won't generate 10*10 matrix. And second problem is I... (6 Replies)
Discussion started by: solaris_user
6 Replies

8. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

9. Red Hat

How to check values stored in variable?

hey, i have stored values of query like this val_2=$( sqlplus -s rte/rted1@rel75d1 << EOF set heading off select source_id from cvt_istats where istat_id > $val_1; exit EOF ) echo $val_2 now , val_2 has five values displayed like this 1 2 3 4 5 what i have to do is to check the... (1 Reply)
Discussion started by: ramsavi
1 Replies

10. Shell Programming and Scripting

Need help on awk to compare only integer on particular column

Hi, 0.23 2.94% 0.00 0.00% 17.8G 55.7% 19.6G 40.9% 630 0.00% 0.06 0.77% - - 7524M 22.9% 15.6G 32.6% - - From the above sample output. I need to compare whether the 6th field is more than 10G..if so print the entire line. Here the 6th field is memory TIA (5 Replies)
Discussion started by: Sumanthsv
5 Replies
ATOI(3) 						     Linux Programmer's Manual							   ATOI(3)

NAME
atoi, atol, atoll, atoq - convert a string to an integer. SYNOPSIS
#include <stdlib.h> int atoi(const char *nptr); long atol(const char *nptr); long long atoll(const char *nptr); long long atoq(const char *nptr); DESCRIPTION
The atoi() function converts the initial portion of the string pointed to by nptr to int. The behaviour is the same as strtol(nptr, (char **)NULL, 10); except that atoi() does not detect errors. The atol() and atoll() functions behave the same as atoi(), except that they convert the initial portion of the string to their return type of long or long long. atoq() is an obsolete name for atoll(). RETURN VALUE
The converted value. CONFORMING TO
SVID 3, POSIX.1, BSD 4.3, ISO/IEC 9899. ISO/IEC 9899:1990 (C89) and POSIX.1 (1996 edition) include the functions atoi() and atol() only; C99 adds the function atoll(). NOTES
The non-standard atoq() function is not present in libc 4.6.27 or glibc 2, but is present in libc5 and libc 4.7 (though only as an inline function in <stdlib.h> until libc 5.4.44). The atoll() function is present in glibc 2 since version 2.0.2, but not in libc4 or libc5. SEE ALSO
atof(3), strtod(3), strtol(3), strtoul(3) GNU
2000-12-17 ATOI(3)
All times are GMT -4. The time now is 04:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy