Sponsored Content
Top Forums Shell Programming and Scripting how to convert a string to int Post 302068863 by dhananjaysk on Tuesday 21st of March 2006 10:39:32 AM
Old 03-21-2006
try it out

To increment
echo enter the string
read str
str=`expr $str + 1`
echo $str


for integer
declare following in your script
typeset -i str
 

10 More Discussions You Might Find Interesting

1. Programming

to convert int to hex

Hi, Can you help me in converting int value to hex in a single command. Thanks (8 Replies)
Discussion started by: naan
8 Replies

2. Solaris

Convert DWORD to int on solaris for 64-bit

i am converting application from 32-bit to 64-bit on Solaris. How can I convert "DWORD" on Solaris 64-bit to int. Thanks. (1 Reply)
Discussion started by: amit_27
1 Replies

3. Shell Programming and Scripting

Compare string output to int value?

Hi, i'd like to implmeent emergency shutdown script in case our AC dies and the temperature rises too high. I can get core temperatures with: sensors | grep Core | cut -c15-16 Result is: 23 18 18 13 21 18 15 17 How can I check if any of the cores is above eg. 80 (that's C of... (2 Replies)
Discussion started by: zapp0
2 Replies

4. Shell Programming and Scripting

From string to int ?

hello guys i m new to shell scripting and can't find out why this structure is not right I m guessing this happens because $LINESUM is a string . so how can i do this ? i want my script to do so many loops as the number of the lines of one custom file. #!/bin/bash echo give me path name... (5 Replies)
Discussion started by: xamxam
5 Replies

5. Programming

Handle int listen(int sockfd, int backlog) in TCP

Hi, from the manual listen(2): listen for connections on socket - Linux man page It has a parameter called backlog and it limits the maximum length of queue of pending list. If I set backlog to 128, is it means no more than 128 packets can be handled by server? If I have three... (3 Replies)
Discussion started by: sehang
3 Replies

6. Programming

How to pass int and return string in C?

hi I want to write a function which takes int as input and returns a string like this. char GetString(int iNo) { switch(iNo) { case 0: return "Zero"; break; case 1: return "One"; break; } } void main() { int i; printf("Enter... (1 Reply)
Discussion started by: atharalikhan
1 Replies

7. Shell Programming and Scripting

Bash shell script: Str(007) to int(7),increment it(8) & convert back to string(008)

Hi, I have the following requirement. There will be following text/line in a file (eg: search-build.txt) PRODUCT_VERSION="V:01.002.007.Build1234" I need to update the incremental build number (eg here 007) every time I give a build through script. I am able to search the string and get... (4 Replies)
Discussion started by: drwatson_droid
4 Replies

8. Programming

IPv4 string->int

Does anyone know how to convert a IP address given as 'string' into a 'u_int32_t'? Are there any build any functions already? (1 Reply)
Discussion started by: Freaky123
1 Replies

9. Programming

Splitting string and storing in int

I have a string containing 2 integers separated by /, for example 12/8 or 8/6 am want to store the numbers in two integers. (3 Replies)
Discussion started by: kristinu
3 Replies

10. Shell Programming and Scripting

Convert int to string in python

Hi, I have column 5 in a file which contains string like this for ex. RP11-125O5.2 SLCO1B1 CAPN1 FRMPD2 TXNL4B So I do by data = )] ValueError: invalid literal for int() with base 10: 'R' Can someday tell me how to convert this column into int successfully. Thank You in... (7 Replies)
Discussion started by: rossi
7 Replies
Ns_ConnRead(3aolserver) 				   AOLserver Library Procedures 				   Ns_ConnRead(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnGets, Ns_ConnRead, Ns_ConnFlushHeaders, Ns_ConnReadHeaders, Ns_ConnReadLine - Routines to copy connection content SYNOPSIS
#include "ns.h" char * Ns_ConnGets(buf, bufsize, conn) int Ns_ConnFlushContent(conn) int Ns_ConnRead(conn, vbuf, toread) int Ns_ConnReadHeaders(conn, set, nreadPtr) int Ns_ConnReadLine(conn, dsPtr, nreadPtr) ARGUMENTS
char *buf (in) Pointer to string buffer of length bufsize. int bufsize (in) Length of buffer pointer to by buf. Ns_Conn conn (in) Pointer to open connection. Ns_DString dsPtr (out) Pointer to initialized dstring to receive copied line. int *nreadPtr(out) Pointer to integer to receive number of bytes copied. Ns_Set set (in/out) Pointer to initialized Ns_Set to copy headers. int toread (in) Number of bytes to copy to location starting at vbuf void *vbuf (in) Pointer to memory location to copy content. _________________________________________________________________ DESCRIPTION
These routines support copying content from the connection. They all operate by copying from the content buffer returned by a call to Ns_ConnContent, maintaining a private, shared offset into the content. This means that these routines are not actually reading directly from the network and thus will not block waiting for input. See the man page on Ns_ConnContent for details on how the content is pre-read by the server and how resources are managed for small and large content requests. char *Ns_ConnGets(buf, bufsize, conn) Copies the next available line of text from the content to the given buf string, up to the given bufsize less space for a trailing null (). The result is a pointer to buf or NULL if an underlying call to Ns_ConnRead fails. int Ns_ConnFlushContent(conn) Performs a logical flush of the underlying content available to these routines. It simply moves the private offset to the end of the content. The result is NS_OK unless an underlying call to Ns_ConnContent failed in which case NS_ERROR is returned. int Ns_ConnRead(conn, vbuf, toread) Copies up to toread bytes from the content to the memory location pointed to by vbuf. The result is the number of bytes copied which will match toread unless less bytes are available in the input or -1 if an underlying call to Ns_ConnContent failed. int Ns_ConnReadHeaders(conn, set, nreadPtr) Copies lines up to the first blank line or end of content up to the maximum header read size specified with the communication driver "maxheader" parameter (default: 32k). Each line is parsed into "key: value" pairs into the given Ns_Set pointed to be the set argu- ment using the Ns_ParseHeader routine with the Ns_HeaderCaseDisposition specified by the "headercase" server option (default: Pre- serve). The result is NS_OK if all lines were consumed or NS_ERROR on overflow beyond the max header limit or if there was an error with the underlying call to Ns_ConnRead (including an error of a single line beyond the max line limit as described below). The integer pointed to by the nreadPtr argument, if given, is updated with the total number of bytes consumed. This routine can be use- ful when parsing multipart/form-data content to collect headers for each part. int Ns_ConnReadLine(conn, dsPtr, nreadPtr) Copies the next available line to the given dsPtr dstring. The integer pointed to by nreadPtr, if present, is updated with the num- ber of bytes copied. The line will not include the trailing or if present. The function will return NS_OK unless an under- lying call to Ns_ConnContent failed or the line exceeds the maximum line read size specified by the communication driver "maxline" parameter (default: 4k). This routine differs from Ns_ConnGets in that it copies the result to a dstring instead of a character buffer, requires a full or end-of-content terminated line, and enforces the maxline limit. SEE ALSO
Ns_ConnContent(3), Ns_ParseHeader(3) KEYWORDS
connection, read, content AOLserver 4.0 Ns_ConnRead(3aolserver)
All times are GMT -4. The time now is 09:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy