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
M4(1) User Commands M4(1)
NAME
M4 - macro processor
SYNOPSIS
m4 [OPTION]... [FILE]...
DESCRIPTION
Process macros in FILEs. If no FILE or if FILE is `-', standard input is read.
Mandatory or optional arguments to long options are mandatory or optional for short options too.
Operation modes:
--help display this help and exit
--version
output version information and exit
-E, --fatal-warnings
stop execution after first warning
-e, --interactive
unbuffer output, ignore interrupts
-P, --prefix-builtins
force a `m4_' prefix to all builtins
-Q, --quiet, --silent
suppress some warnings for builtins
Preprocessor features:
-D, --define=NAME[=VALUE]
define NAME has having VALUE, or empty
-I, --include=DIRECTORY
append DIRECTORY to include path
-s, --synclines
generate `#line NUM "FILE"' lines
-U, --undefine=NAME
undefine NAME
Limits control:
-G, --traditional
suppress all GNU extensions
-H, --hashsize=PRIME
set symbol lookup hash table size [509]
-L, --nesting-limit=NUMBER
change artificial nesting limit [1024]
Frozen state files:
-F, --freeze-state=FILE
produce a frozen state on FILE at end
-R, --reload-state=FILE
reload a frozen state from FILE at start
Debugging:
-d, --debug[=FLAGS]
set debug level (no FLAGS implies `aeq')
-l, --arglength=NUM
restrict macro tracing size
-o, --error-output=FILE
redirect debug and trace output
-t, --trace=NAME
trace NAME when it will be defined
FLAGS is any of:
a show actual arguments
c show before collect, after collect and after call
e show expansion
f say current input file name
i show changes in input files
l say current input line number
p show results of path searches
q quote values as necessary, with a or e flag
t trace for all macro calls, not only traceon'ed
x add a unique macro call id, useful with c flag
V shorthand for all of the above flags
If defined, the environment variable `M4PATH' is a colon-separated list of directories included after any specified by `-I'.
Exit status is 0 for success, 1 for failure, 63 for frozen file version mismatch, or whatever value was passed to the m4exit macro.
AUTHOR
Written by Rene' Seindal.
REPORTING BUGS
Report bugs to <bug-m4@gnu.org>.
COPYRIGHT
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
The full documentation for M4 is maintained as a Texinfo manual. If the info and M4 programs are properly installed at your site, the com-
mand
info m4
should give you access to the complete manual.
FSF
August 2006 M4(1)