str[0] is the first character in the string, str[strlen(str)] is one beyond the last character of the string, etc, etc. I have no idea how you expected to get HelloWorld.
You should not be declaring arrays with dynamic sizes. Never use things like strlen() in an array size.
STL has absolutely no purpose here since you're using C strings.
hi, I was wondering if there was a good way to create an array within a function, where the name is based on a passed argument? I tried this:
_____________________________
func(){
#take in 1st arg as the arrayname
arrayName=$1
let i=0
while read line
do
arrayName=${line}
let i+=1... (5 Replies)
Im trying to write some code atm which gets the complete pathname of a folder and strips off references to the parent folders. The end result should be just the name of the folder.
Currently Im able to extract the folder name, however Im getting junk added onto the name as well which is making... (7 Replies)
I have the following function in a bash script that fails to return the sorted array. I think the problem lies in the recursion not correctly passing the arrays, but I can't tell what I'm doing wrong. Anyone see the problem?
function quicksort () {
local array=( `echo "$1"` )
local... (7 Replies)
This is in C++.
Is there a way to take characters out of input data?
For example, hello 0 1 2 3 4 5 is within my double dimensional array:
char arr;
How would I output only the characters h,e,l,l,o? (0 Replies)
why does this not work?
#include <stdio.h>
#include <stdlib.h>
char getFileMode(char charChanger) {
char filetype; /*var to hold the value to be returned*/
filetype = charSetter; /*set filetype to "l" if it is a symlink*/
return filetype;
}
int main(void){
char... (8 Replies)
As this function returns the address of the string corressponding to the errno value provided to it. Can someone please let me know where, in the memory, it could be (on freeBSD).
The MAN page tells under the BUG section that "For unknown error numbers, the strerror() function will return its... (5 Replies)
Hi all
Does anyone know Java-Arrays.binarySearch function equivalent in awk
I tried like this but it's not correct one,it just returns array index if and only when searched value available in array, for some reason if searched value not found then I want to return upper nearest neighbour index.... (1 Reply)
Hello Friends,
I would appreciate so much if you could explain how the underscores works at the following code? Sorry if it sounds a bit novice question.
awk -F',' 'NR==FNR{_=1;next}!_{print}' exclude infile
KR,
Eagle (6 Replies)
Hi Guys,
I need a help to creating a bash script to merging two files that containing not in order pattern into single file also within that single file I need to concatenate and manipulate the string from two files. Appreciate for any kind help given.
Thanks.
Here are the input files:... (3 Replies)
I am passing a char* to the function "reverse" and when I execute it with gdb I get:
Program received signal SIGSEGV, Segmentation fault.
0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72
72 *q = *p;
Attached is the source code.
I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies
LEARN ABOUT ULTRIX
waddstr
addstr(3cur)addstr(3cur)Name
addstr, waddstr, mvaddstr, mvwaddstr - add string to window
Syntax
#include <cursesX.h>
int addstr(str)
char *str;
int waddstr(win, str)
WINDOW *win;
char *str;
int mvaddstr(y, x, str)
int y, x;
char *str;
int mvwaddstr(win, y, x, str)
WINDOW *win;
int y, x;
char *str;
Description
The routine writes all the characters of the null-terminated character string on the default window at the current (y, x) coordinates.
The routine writes all the characters of the null terminated character string on the specified window at the current (y, x) coordinates.
The routine writes all the characters of the null terminated character string on the default window at the specified (y, x) coordinates.
The routine writes all the characters of the null terminated character string on the specified window at the specified (y, x) coordinates.
The following information applies to all the routines. All the routines return if writing the string causes illegal scrolling. In this
case the routine will write as much as possible of the string on the window.
These routines are functionally equivalent to calling or once for each character in the string.
The routines and are macros.
Return Values
The and functions return OK on success and ERR on error.
See Alsoaddch(3cur), waddch(3cur)addstr(3cur)