06-07-2011
hi
Here is the working code
/* This method takes String, Start Length and End Length as input parameters, sub string the string and returns it */
char* getsubstring(const char* urstr, size_t beginL, size_t len)
{
if (urstr == 0 || strlen(urstr) == 0 || strlen(urstr) < begin || strlen(urstr) < (beginL+len))
return 0;
return strndup(urstr + beginL, len);
}
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi Guys
I using Solaris 8 and I need to change the size of my /tmp file. Was wondering does anyone know how to do this.
Thanks
Carson (1 Reply)
Discussion started by: cmackin
1 Replies
2. Programming
Hi Folks
can any body suggest how to allocate virtual memory any function for that (2 Replies)
Discussion started by: munnu
2 Replies
3. UNIX for Advanced & Expert Users
On SunOS 5.8 I get an error when starting a large Java process with over 2Gb memory.
Error occurred during initialization of VM
Could not reserve enough space for object heap
When stopping several other Java processes we can start this process. This seems to indicate that we don't have... (11 Replies)
Discussion started by: rein
11 Replies
4. UNIX for Advanced & Expert Users
Hi,
I have 2 systems with same hardware and software. One system is giving me error "Error occurred during initialization of VM Could not reserve enough space for object " when I tried to increase JBoss App's heap size to 2GB while the other system is running fine without any issue. Is there... (5 Replies)
Discussion started by: ravi3553
5 Replies
5. UNIX for Advanced & Expert Users
hi... i want to find oracle allocate how many memory really..
i execute this code to list memory on unix system : ps -eo pmem,args | sort -k 1 -r -n
outputs ;
%mem command
12.9|ora_smon_RTX
12.9|ora_s000_RTX
12.9|ora_reco_RTX
12.9|ora_qmnc_RTX... (2 Replies)
Discussion started by: utoptas
2 Replies
6. SuSE
Hi,
In my proj, one process was running for 2 days. after 2 days its throwing an error message "shmget failed cannot allocate memory". the same problem happened every time.i.e. i can reproduce the same issue if my process is running for every 2 days for a same operation.Within this 2 days there... (1 Reply)
Discussion started by: ManoharanMani
1 Replies
7. Linux
Hi,
In my proj, one process was running for 2 days. after 2 days its throwing an error message "shmget failed cannot allocate memory". the same problem happened every time.i.e. i can reproduce the same issue if my process is running for every 2 days for a same operation.Within this 2 days there... (1 Reply)
Discussion started by: ManoharanMani
1 Replies
8. Linux
Hi,
In my proj, one process was running for 2 days. after 2 days its throwing an error message "shmget failed cannot allocate memory". the same problem happened every time.i.e. i can reproduce the same issue if my process is running for every 2 days for a same operation.Within this 2 days there... (1 Reply)
Discussion started by: ManoharanMani
1 Replies
9. Solaris
On SunOS 10 get an error when starting a large Java process with over 2Gb memory.
Error occurred during initialization of VM
Could not reserve enough space for object heap
i have 32G memory !! , swap = 31G
Please any advice !!! (3 Replies)
Discussion started by: moata_u
3 Replies
10. Programming
Hi , experts.
I work on Linux station (RedHat 5.7), regular user, but have root password.
%> uname -a
Linux ran1log06 2.6.18-238.1.1.el5 #1 SMP Tue Jan 4 13:32:19 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
%> cat /etc/issue
Red Hat Enterprise Linux Client release 5.7 (Tikanga)
Kernel \r on... (5 Replies)
Discussion started by: baruchgu
5 Replies
LEARN ABOUT CENTOS
stringlabels
StringLabels(3) OCaml library StringLabels(3)
NAME
StringLabels - String operations.
Module
Module StringLabels
Documentation
Module StringLabels
: sig end
String operations.
val length : string -> int
Return the length (number of characters) of the given string.
val get : string -> int -> char
String.get s n returns character number n in string s . The first character is character number 0. The last character is character number
String.length s - 1 . You can also write s.[n] instead of String.get s n .
Raise Invalid_argument index out of bounds if n is outside the range 0 to (String.length s - 1) .
val set : string -> int -> char -> unit
String.set s n c modifies string s in place, replacing the character number n by c . You can also write s.[n] <- c instead of String.set s
n c . Raise Invalid_argument index out of bounds if n is outside the range 0 to (String.length s - 1) .
val create : int -> string
String.create n returns a fresh string of length n . The string initially contains arbitrary characters. Raise Invalid_argument if n < 0
or n > Sys.max_string_length .
val make : int -> char -> string
String.make n c returns a fresh string of length n , filled with the character c . Raise Invalid_argument if n < 0 or n >
Sys.max_string_length .
val copy : string -> string
Return a copy of the given string.
val sub : string -> pos:int -> len:int -> string
String.sub s start len returns a fresh string of length len , containing the characters number start to start + len - 1 of string s .
Raise Invalid_argument if start and len do not designate a valid substring of s ; that is, if start < 0 , or len < 0 , or start + len >
StringLabels.length s .
val fill : string -> pos:int -> len:int -> char -> unit
String.fill s start len c modifies string s in place, replacing the characters number start to start + len - 1 by c . Raise Invalid_argu-
ment if start and len do not designate a valid substring of s .
val blit : src:string -> src_pos:int -> dst:string -> dst_pos:int -> len:int -> unit
String.blit src srcoff dst dstoff len copies len characters from string src , starting at character number srcoff , to string dst , start-
ing at character number dstoff . It works correctly even if src and dst are the same string, and the source and destination chunks overlap.
Raise Invalid_argument if srcoff and len do not designate a valid substring of src , or if dstoff and len do not designate a valid sub-
string of dst .
val concat : sep:string -> string list -> string
String.concat sep sl concatenates the list of strings sl , inserting the separator string sep between each.
val iter : f:(char -> unit) -> string -> unit
String.iter f s applies function f in turn to all the characters of s . It is equivalent to f s.[0]; f s.[1]; ...; f s.[String.length s -
1]; () .
val iteri : f:(int -> char -> unit) -> string -> unit
Same as String.iter , but the function is applied to the index of the element as first argument (counting from 0), and the character itself
as second argument.
Since 4.00.0
val map : f:(char -> char) -> string -> string
String.map f s applies function f in turn to all the characters of s and stores the results in a new string that is returned.
Since 4.00.0
val trim : string -> string
Return a copy of the argument, without leading and trailing whitespace. The characters regarded as whitespace are: ' ' , '