In this case str points to location that has the initialized value which could be either ready only or read writable.If it happens to be on read only then the strtok function may not be able to modify the string and so generates the SEGV
You could change that to,
Thanks
Nagarajan G
Dear Nagarajan,
Thanks for ur detailed explaination of strtok.
I fully agree with ur comment.
but however strtok should not be used in threads. can u explain me why?
they say in such case its safe to use strtok_r().
Hi all,
Right now I'm using this but it seems to be a hack:
if (prefix(arg, "mark=")) {
for (markid = strtok(args,"="); markid; markid=strtok((char *)NULL, "=")) {
basically the user passes "mark=ny" to the command. I want to be able to extract "ny" from that... (7 Replies)
Hi,
I just wrote a program in C to split a comma seperated string in to group of strings using strtok() function. The code is:
int main()
{
char *temp;//not used here but basically we extract one string after another using strtok() and assign to a string pointer defined like this.
... (3 Replies)
Hi ,
I have three funcions f1, f2 and f3 .
f1 calls f2 and f2 calls f3 .
I have a global variable "period" which i want to pass to f3 .
Can i pass the variable directly in the definition of f3 ?
Pls help .
sars (4 Replies)
Why is line (null) after the first while loop run? (keyword does jump to the next word.)
#include <ftw.h>
#include <stdio.h>
#include <string.h>
char filenames = "";
int list(const char *name, const struct stat *status, int type)
{
if( (type == FTW_F) && strstr(name, ".txt") &&... (3 Replies)
Dear All.
I have a script, which process files one by one. In the script I have two functions.
one sftp files to different server
the other from existing file create file with different name.
My question is:
Will sftp function recognize files names , which are created in another... (1 Reply)
Hi All,
Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition.
#Body
function1()
{
if
then
echo "exist"
else
echo "not exist"
}
#if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
LEARN ABOUT CENTOS
addnstr
curs_addstr(3X)curs_addstr(3X)NAME
addstr, addnstr, waddstr, waddnstr, mvaddstr, mvaddnstr, mvwaddstr, mvwaddnstr - add a string of characters to a curses window and advance
cursor
SYNOPSIS
#include <curses.h>
int addstr(const char *str);
int addnstr(const char *str, int n);
int waddstr(WINDOW *win, const char *str);
int waddnstr(WINDOW *win, const char *str, int n);
int mvaddstr(int y, int x, const char *str);
int mvaddnstr(int y, int x, const char *str, int n);
int mvwaddstr(WINDOW *win, int y, int x, const char *str);
int mvwaddnstr(WINDOW *win, int y, int x, const char *str, int n);
DESCRIPTION
These functions write the (null-terminated) character string str on the given window. It is similar to calling waddch once for each char-
acter in the string.
The mv functions perform cursor movement once, before writing any characters. Thereafter, the cursor is advanced as a side-effect of writ-
ing to the window.
The four functions with n as the last argument write at most n characters, or until a terminating null is reached. If n is -1, then the
entire string will be added.
RETURN VALUE
All functions return the integer ERR upon failure and OK on success.
X/Open does not define any error conditions. This implementation returns an error
o if the window pointer is null or
o if the string pointer is null or
o if the corresponding calls to waddch return an error.
Functions with a "mv" prefix first perform a cursor movement using wmove, and return an error if the position is outside the window, or if
the window pointer is null.
NOTES
All of these functions except waddnstr may be macros.
PORTABILITY
These functions are described in the XSI Curses standard, Issue 4.
SEE ALSO curses(3X), curs_addch(3X).
curs_addstr(3X)