Hello,
This function was copied into my code, which was compiled without error/warning, but when executed there is always Segmentation fault at the end after the output (which seems correct!):
Then I used gdb to debug, and I got this message:
The problem line has been highlighted. Code for the whole program is attached. I used type cast to suppress the warnings at compiling without full understanding.
Can someone explain the error for me, and show me the correct fix?
Thanks a lot!
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
ftwhich
FTWHICH(1) General Commands Manual FTWHICH(1)NAME
ftwhich - fault tolerant search for a command name
SYNOPSIS
ftwhich [-#hIp][-t#] program_name
DESCRIPTION
ftwhich is a fault tolerant version of the which(1) command. ftwhich searches for a given program in all directories included in your PATH
environment variable and reports all files with a name that approximately matches the given program_name.
ftwhich achieves fault tolerance by calculating the so called Weighted Levenshtein Distance. The Levenshtein Distance is defined as the
minimum number of character insertions, deletions and replacements that transform a string A into a string B.
ftwhich is similar to the which command with the following differences:
- ftwhich is by default NOT case sensitive
- ftwhich is fault tolerant
- Some shells have a build in which command that will also search aliases. ftwhich can naturally not search for aliases as it does
not know about alias definitions.
- ftwhich lists all files that approximately match. The files first shown take preference over files of the same name printed later as
they are from directories listed earlier in the PATH.
- The level of fault tolerance can be adjusted by specifying the optional parameter tolerance. A tolerance of 0 specifies exact
match.
OPTIONS -h Prints help/usage information.
-I Do case sensitive search (default is case in-sensitive)
-p print the actual distance value in front of the found filename. This value is equal to the number of insertions, deletions and
replacements necessary to transform the name of the found program into the search key.
-# or -t#
Set the fault tolerance level to #. The fault tolerance level is an integer in the range 0-255. It specifies the maximum number of
errors permitted in finding the approximate match. The default tolerance is (strlen(searchpattern) - number of wildcards)/6 + 1
program_name
The program file to search for. '*' and '?' can be used as wildcards.
'?' denotes one single character.
'*' denotes an arbitrary number of characters.
The last argument to ftwhich is not parsed for options as the program needs at least one program_name argument. This means that ftwhich -x
will not complain about a wrong option but search for the program named -x.
EXAMPLE
Search for all programs like gcc in your PATH:
ftwhich gcc
This will e.g. find gcc or cc or CC ...
To find all files that start with any prefix and end in config and differ in 2 letters from the word config:
ftwhich -2 '*config'
To find all files that exactly start with the prefix if:
ftwhich -0 'if*'
To find all clock programs:
ftwhich -0 '*clock*'
BUGS
The wildcards '?' and '*' can not be escaped. These characters function always as wildcards. This is however not a big problem since there
is normally hardly any command that has these characters in its name.
AUTHOR
Guido Socher (guido@linuxfocus.org)
SEE ALSO whichman(1), ftff(1)Search utilities January 1999 FTWHICH(1)