03-03-2016
Quote:
Originally Posted by
yifangt
... I used type cast to suppress the warnings at compiling without full understanding.
Now you have some understanding of why you shouldn't use type casts to suppress warnings.
Quote:
Can someone explain the error for me, and show me the correct fix?
Thanks a lot!
You're trying to take the length of a string - but it's not a string.
10 More Discussions You Might Find Interesting
1. Programming
hello,
i have a problem with strlen. I have written this:
for(y=13,z=0; cInBuf!=' ';y++)
{
cBuf=cInBuf;
z++;
}
len = strlen(cBuf);
out=len/2;
fprintf(outfile,"F%i",out);
If strlen is e.g. 22, it write F22. I want to write F2F2.
How can i do this?... (5 Replies)
Discussion started by: ACeD
5 Replies
2. Shell Programming and Scripting
Hello,
Just a little problem with the ksh function : strlen
I want to use this function in this little ksh program :
while read line ; do
TOTO=$line
TOTONB=strlen($TOTO)
echo $TOTONB (3 Replies)
Discussion started by: steiner
3 Replies
3. Programming
When run it, segment fault.
What is wrong?
#include <stdio.h>
#include <stdlib.h>
const int max =20;
//****************************************************
// Input Matrix
//****************************************************
void inMatrixAA(int *AA, int row, int col)... (9 Replies)
Discussion started by: zhshqzyc
9 Replies
4. Programming
In a declaration, I have:
const char comment_begin = "<!--";
const char comment_end = "-->";
const int comment_begin_len = strlen(comment_begin);
const int comment_end_len = strlen(comment_end);
When I compile, I get the warnings:
emhttpc.c:64: warning: initializer element is not... (10 Replies)
Discussion started by: cleopard
10 Replies
5. Programming
Hi all
In the ltp-posix test,there is a case in open_posix_testsuite\conformance\interfaces\timer_gettime\speculative/6-1.c
I run the above code,it will has a segment fault, if I modify it to below,it works well
Anybody can tell me why? (1 Reply)
Discussion started by: yanglei_fage
1 Replies
6. Programming
My OS (Debian) and gcc use the UTF-8 locale. This code says that the char size is 1 byte but the size of 'a' is really 4 bytes.
int main(void)
{
setlocale(LC_ALL, "en_US.UTF-8");
printf("Char size: %i\nSize of char 'a': %i\nSize of Euro sign '€': %i\nLength of Euro sign: %i\n",... (8 Replies)
Discussion started by: cyler
8 Replies
7. Programming
Hi,
Whether the following piece of code is placed in the read-only memory of code (text) segment or data segment?
char *a = "Hello";
I am getting two different answers while searching in google :( that's why the confusion is (7 Replies)
Discussion started by: royalibrahim
7 Replies
8. Programming
I always get segment fault, why? can sb help me and modify it, I have spend on much time on
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
#define MAX 10
pthread_t thread;
void *thread1()
{
int *a;
int i, n;
... (1 Reply)
Discussion started by: yanglei_fage
1 Replies
9. Programming
Hi
I have struggling a week to fix a program , in the begining i got SIGBUS , but after many attempts still the program gets SIGSEGV segment fault , In bellow i post the seg fault log + source codes. would really appreciate if experts help me to fix this segment fault error. any advice is... (2 Replies)
Discussion started by: pooyair
2 Replies
10. Programming
I am trying to reverse complement DNA sequence (string) with a short c++ code using boost library. Code was compiled without any warning/error, but ran into Segmentation fault.
My guess is the function to return a vector, but not sure.
#include <iostream>
#include <fstream>
#include <string>... (14 Replies)
Discussion started by: yifangt
14 Replies
LEARN ABOUT DEBIAN
whichman
WHICHMAN(1) General Commands Manual WHICHMAN(1)
NAME
whichman - show the location of a man page using a fault tolerant approximate matching algorithm
SYNOPSIS
whichman [-#ehIp][-t#] man-page-name
DESCRIPTION
whichman is a "which" alike search command for man pages. whichman searches the MANPATH environment variable. If this variable is not
defined, then it uses /usr/share/man:/usr/man:/usr/X11R6/man: /usr/local/share/man:/usr/local/man by default.
Unlike "which" this program does not stop on the first match. The name should probably have been something like whereman as this is not a
"which" at all. whichman shows all man-pages that match and allows you to identify the different sections to which the pages belong.
whichman can handle international manpage path names for different languages. Man pages in different languages may be stored in
.../man/<country_code>/man[1-9]/...
By default, whichman does fault tolerant approximate string matching. With a default tolerance level of: (strlen(searchpattern) - number of
wildcards)/6 + 1
OPTIONS
-h Prints a little help/usage information.
-I Do case sensitive search (default is case in-sensitive)
-e Use exact matching when searching for a given man-page and the wildcards * and ? are disabled.
-p print the actual tolerance level in front of the man page name.
-# or -t#
Set the fault tolerance level to #. The fault tolerance level is a integer # in the range 0-255. It specifies the maximum number
of errors permitted in finding the approximate match. A tolerance_level of zero allows exact matches only but does NOT disable the
wildcards * and ?.
The search key may contain the wildcards * and ? (but see -e option):
'*' any arbitrary number of character
'?' one character
The last argument to whichman is not parsed for options as the program needs at least one man-page-name argument. This means that whichman
-x will not complain about a wrong option but search for the man-page named -x.
EXAMPLE
whichman print
This will e.g. find the man-pages:
/usr/share/man/man1/printf.1.gz
/usr/share/man/man3/printf.3.gz
/usr/share/man/man3/rint.3.gz
BUGS
The wildcards '?' and '*' can not be escaped. These characters function always as wildcards. This is however not a big problem since there
is hardly any man-page that has these characters in its name.
AUTHOR
Guido Socher (guido@linuxfocus.org)
SEE ALSO
ftff(1), man(1)
Search utilities April 1998 WHICHMAN(1)