03-03-2016
Segmentation fault still there
Thanks achenle, you said it is not a string, but it seems the program has done what I expected except the "segmentation fault" error. Can you please show me the fix, if possible?
Murphy! I made the change, but the error still there!
Last edited by yifangt; 03-07-2016 at 12:07 PM..
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 LINUX
annotate-output
ANNOTATE-OUTPUT(1) General Commands Manual ANNOTATE-OUTPUT(1)
NAME
annotate-output - annotate program output with time and stream
SYNOPSIS
annotate-output [options] program [args ...]
DESCRIPTION
annotate-output will execute the specified program, while prepending every line with the current time and O for stdout and E for stderr.
OPTIONS
+FORMAT
Controls the timestamp format, as per date(1). Defaults to "%H:%M:%S".
-h, --help
Display a help message and exit successfully.
EXAMPLE
$ annotate-output make
21:41:21 I: Started make
21:41:21 O: gcc -Wall program.c
21:43:18 E: program.c: Couldn't compile, and took me ages to find out
21:43:19 E: collect2: ld returned 1 exit status
21:43:19 E: make: *** [all] Error 1
21:43:19 I: Finished with exitcode 2
BUGS
Since stdout and stderr are processed in parallel, it can happen that some lines received on stdout will show up before later-printed
stderr lines (and vice-versa).
This is unfortunately very hard to fix with the current annotation strategy. A fix would involve switching to PTRACE'ing the process.
Giving nice a (much) higher priority over the executed program could however cause this behaviour to show up less frequently.
The program does not work as well when the output is not linewise. In particular, when an interactive program asks for input, the question
might not be shown until after you have answered it. This will give the impression that the annotated program has hung, while it has not.
SEE ALSO
date(1)
SUPPORT
This program is community-supported (meaning: you'll need to fix it yourself). Patches are however appreciated, as is any feedback (posi-
tive or negative).
AUTHOR
annotate-output was written by Jeroen van Wolffelaar <jeroen@wolffelaar.nl> This manpage comes under the same copyright as annotate-output
itself, read /usr/bin/annotate-output (or wherever you install it) for the details.
DEBIAN Debian Utilities ANNOTATE-OUTPUT(1)