11-10-2005
Not sure why you're using the memset, and strcpy,strcat thing. Nor can I tell why you have an undisplayable char at the front of each string, although I'm pretty sure that those chars are prepended to the beginning of CityName & CountryName prior to the code you show here. But back to my point, why aren't you just using sprintf to do this? Kind of like this:
pstSimPOIInfo[uiI].ppcName[ucCount] = realloc(pstSimPOIInfo[uiI].ppcName[ucCount], (usLen+strlen(CountryName)+4));
sprintf(pstSimPOIInfo[uiI].ppcName[ucCount],
"%s,%s",
CityName,
CountryName);
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am working on a script that prompts a user name and creates a list in a username.dat file. Furthermore, I have created a sorted_username.dat file. My question is this: My script uses the word "finished" != finished to break the while loop. How can I avoid having the word "finished" show up in... (5 Replies)
Discussion started by: erest8
5 Replies
2. Shell Programming and Scripting
Hi All,
I want to remove last word from a line using Vi.
Do we have any vi command for that.
line : ss dd ff gg
i have to run some vi command which can delete gg from the line
Thanks,
Ravi Sadani (4 Replies)
Discussion started by: ravi.sadani19
4 Replies
3. Shell Programming and Scripting
Hi All,
In one of the sections in my perl script, I need to remove the 1st character of a word and store in an array.The details are ,
The original script was ,
if ( ! defined $inq{$node}{"dmx"} ) {
print "INFO: Collecting inq disk information for DMX array on $node.\n";
... (2 Replies)
Discussion started by: abhilash.pa
2 Replies
4. Shell Programming and Scripting
hi
I would like to ask if someone knows a command or a script on how to rename a multiple file in the directory starting at the end of the filename or at the .extension( i would like to remove the last 11 character before the extension) for example
Below is the result of my command ls inside... (5 Replies)
Discussion started by: jao_madn
5 Replies
5. Shell Programming and Scripting
Hello! This is my first post here.
I have a file with text like:
A</title>
B
C</title>
D
I need to format it to:
AB
CD
I am trying to use sed: sed 's/<//title>\n/ /g' file > newfile
to delete </title> and the newline character, but the file is unchanged because there are... (3 Replies)
Discussion started by: DaytonCPS
3 Replies
6. Shell Programming and Scripting
lets say i have a file named ex1 which contain an essay.
(a) delete the word "benefit" from the file
(b) delete the last 6 characters on each line
for the first problem i entered :g/benefit/d but it deletes the whole line
please help (3 Replies)
Discussion started by: koricha
3 Replies
7. Shell Programming and Scripting
It is very simple to remove a hyphen from a word anywhere in that word using a simple sed command (sed -i 's/-//g' filename), but I am not able to figure out how to do this:
For example,
apple
-orange
tree
pipe-
banana-shake
dupe-
What my output should look like:
apple
orange
tree... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
8. Shell Programming and Scripting
My file has the entries like below...
/dev/sds
/dev/sdak
/dev/sdbc
/dev/sdbu
I want to make the file like below
echo 1 > /sys/block/sds/device/rescan
echo 1 > /sys/block/sdak/device/rescan
echo 1 > /sys/block/sdbc/device/rescan
echo 1 > /sys/block/sdbu/device/rescan (2 Replies)
Discussion started by: saravanapandi
2 Replies
STRING(3) Library Functions Manual STRING(3)
NAME
strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen, index, rindex - string operations
SYNOPSIS
char *strcat(s1, s2)
char *s1, *s2;
char *strncat(s1, s2, n)
char *s1, *s2;
strcmp(s1, s2)
char *s1, *s2;
strncmp(s1, s2, n)
char *s1, *s2;
char *strcpy(s1, s2)
char *s1, *s2;
char *strncpy(s1, s2, n)
char *s1, *s2;
strlen(s)
char *s;
char *index(s, c)
char *s, c;
char *rindex(s, c)
char *s;
DESCRIPTION
These functions operate on null-terminated strings. They do not check for overflow of any receiving string.
Strcat appends a copy of string s2 to the end of string s1. Strncat copies at most n characters. Both return a pointer to the null-termi-
nated result.
Strcmp compares its arguments and returns an integer greater than, equal to, or less than 0, according as s1 is lexicographically greater
than, equal to, or less than s2. Strncmp makes the same comparison but looks at at most n characters.
Strcpy copies string s2 to s1, stopping after the null character has been moved. Strncpy copies exactly n characters, truncating or null-
padding s2; the target may not be null-terminated if the length of s2 is n or more. Both return s1.
Strlen returns the number of non-null characters in s.
Index (rindex) returns a pointer to the first (last) occurrence of character c in string s, or zero if c does not occur in the string.
BUGS
Strcmp uses native character comparison, which is signed on PDP11's, unsigned on other machines.
STRING(3)