Sponsored Content
Top Forums Programming Segment fault related to strlen.S Post 302968081 by fpmurphy on Thursday 3rd of March 2016 01:42:18 PM
Old 03-03-2016
Invalid loop count. Change
Code:
    for (j = 0; j < 23; j++) {

to
Code:
   for (j = 0; j < 22; j++) {

 

10 More Discussions You Might Find Interesting

1. Programming

Problems with Strlen

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

Problem with the strlen function in ksh

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

Segment Fault

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

'strlen' of a constant string

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

a strange segment fault about ltp-posix test

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

strlen for UTF-8

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

Data segment or Text segment

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

why segment fault,

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

Segment-fault handling for pthreads

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

Segment fault for C++ program when return vector

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
pfm_cleanup(3ncs)														 pfm_cleanup(3ncs)

Name
       pfm_cleanup - establish a clean-up handler

Syntax
       #include <idl/c/base.h>
       #include <idl/c/pfm.h>

       status_$t pfm_$cleanup(cleanup_record)
       pfm_$cleanup_rec *cleanup_record;

Arguments
       cleanup_record	   A  record  of the context when is called.  A program should treat this as an opaque data structure and not try to alter
			   or copy its contents.  It is needed by and to restore the context of the calling process at the clean-up handler  entry
			   point.

Description
       The  routine  establishes a clean-up handler that is executed when a fault occurs.  A clean-up handler is a piece of code executed before a
       program exits when a signal is received by the process.	The clean-up handler begins where is called; the routine registers an entry  point
       with the system where program execution resumes when a fault occurs.  When a fault occurs, execution resumes after the most recent call to

       There  can  be  more  than one clean-up handler in a program.  Multiple clean-up handlers are executed consecutively on a last-in/first-out
       basis, starting with the most recently established handler and ending with the first clean-up  handler.	 The  system  provides	a  default
       clean-up  handler  established at program invocation.  The default clean-up handler is always called last, just before a program exits, and
       releases any system resources still held, before returning control to the process that invoked the program.

Diagnostics
       When called to establish a clean-up handler, returns the status pfm_$cleanup_set to indicate the clean-up handler was  successfully  estab-
       lished.	 When the clean-up handler is entered in response to a fault signal, effectively returns the value of the fault that triggered the
       handler.

       This section lists status codes for errors returned by this routine in

       pfm_$bad_rls_order  Attempted to release a clean-up handler out of order.

       pfm_$cleanup_not_found
			   There is no pending clean-up handler.

       pfm_$cleanup_set    A clean-up handler was established successfully.

       pfm_$cleanup_set_signaledl
			   Attempted to use pfm_$cleanup_set as a signal.

       pfm_$invalid_cleanup_rec
			   Passed an invalid clean-up record to a routine.

       pfm_$no_space	   Cannot allocate storage for a clean-up handler.  Clean-up handler code runs with asynchronous faults  inhibited.   When
			   returns  something  other  than  pfm_$cleanup_set indicating that a fault has occurred, there are four possible ways to
			   leave the clean-up code:

			   o	  The program can call to start the next clean-up handler with a different fault signal.

			   o	  The program can call to start the next clean-up handler with the same fault signal.

			   o	  The program can continue with the code following the clean-up handler.  It should  generally	call  to  reenable
				  asynchronous	faults.   Execution  continues from the end of the clean-up handler code; it does not resume where
				  the fault signal was received.

			   o	  The program can reestablish the handler by calling before proceeding.

Files
See Also
       intro(3ncs), pfm_signal(3ncs)

																 pfm_cleanup(3ncs)
All times are GMT -4. The time now is 04:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy