Sponsored Content
Top Forums Programming Why segmentation(coredump) in the following code in C? Post 302530204 by AAKhan on Monday 13th of June 2011 08:44:58 AM
Old 06-13-2011
Why segmentation(coredump) in the following code in C?

hi
I have a method which returns char*. In this method am using switch case. I am getting segmentation error in case 49 and my code is
Code:
case 49:
          if(intFlag == 0210)
          {
                iiIDCode = atoi(getsubstring(sReq,262,2));
                l = atoi(getsubstring(sReq,26+2+iiIDCode,3));
                iiTemp = 26+2+iiFIDCode+l+3;
                j = atoi(getsubstring(sReq,iiTemp,3));
                k  = atoi(getsubstring(sReq,iiTemp+j+3,3));
                fprintf(fp,"\nCurrency Code Transaction:\t\t[%s]",getsubstring       (sReq,iiTemp+j+k+3+3,3));
                strcat(cRes,getsubstring(sReq,iiTemp+j+k+3+3,3));;
          }
         else if(intFlag == 110)
         {
          }   
break;

getsubstring is a method am using to substring the string and it is working fine. If i remove if and else part it is working fine but if i add if else condition in case 49: it is throwing error Segmentation Coredump. Why? What could be the error? How to solve this?
Thanks
 

9 More Discussions You Might Find Interesting

1. AIX

Segmentation fault(coredump)

Hi All Can anybody help me? When ever am trying to run topas system gives me an error Segmentation fault(coredump) does anybody ahve solution for this? (4 Replies)
Discussion started by: vjm
4 Replies

2. Solaris

lpstat gives segmentation coredump error

hi everyone, we have solaris 8 in sun v480 server. it gives this error. Segmentation Fault(coredump) can anyone help me in this - urgently. Regards Karthik C (8 Replies)
Discussion started by: cksriramchandra
8 Replies

3. UNIX for Advanced & Expert Users

Segmentation (CoreDump) error !!

Hi all, I am trying to create few directories using script and its giving me segmentation error. #!/bin/ksh createDirectories() createDirectories() { cat dirs | \ while read line do mkdir... (16 Replies)
Discussion started by: varungupta
16 Replies

4. Shell Programming and Scripting

Segmentation Fault(coredump)

I'm getting this error when trying to run a Acucobol program thru UNIX.. Segmentation Fault(coredump) Precompiler error prevents compilation of xxxxxx.co. Please help me in this case.. (1 Reply)
Discussion started by: Manish4
1 Replies

5. AIX

Segmentation fault in nsgetcinfo in aix 64-bit c code

Hello, I am running on a AIX5.2 server with Oracle 10g and 9i. My code compiles and works fine in 32-bit mode. The same code compiles in 64-bit and runs good. The program catches CNTRL-C signal to terminate. Only on 64-bit code when i hit CNTRL-C, the program exits with segmentation... (0 Replies)
Discussion started by: sumesh0710
0 Replies

6. Programming

C code : Segmentation fault

Hi Friends, I have written a small code in C which performs the below operations Task : 1 ) read line by line from a file. 2 ) assuming 3th and 4th fields of the file as GN and GNTO 3 ) The target file should contain all the fields except GNTO. 4... (3 Replies)
Discussion started by: kiran_bhatter
3 Replies

7. Programming

this code for addind polynomials using linked lists showed segmentation error..any help pls..

the error occurs in the function() "add" used... #include<stdio.h> #include<malloc.h> struct node { int exp; int coef; struct node * link; }; struct node * create_list(struct node *,int,int); void display(struct node *); struct node * add(struct node *,struct node *); ... (3 Replies)
Discussion started by: mscoder
3 Replies

8. Programming

This code keeps giving me a segmentation fault why?

#include<stdlib.h> #include <pthread.h> #include "tlpi_hdr.h" #include <stdio.h> static volatile int glob = 0; static struct { pthread_t t1,t2; } *thread; static void * /* Loop 'arg' times incrementing 'glob' */ threadFunc(void *arg) { int loops = *((int *) arg); ... (1 Reply)
Discussion started by: fwrlfo
1 Replies

9. Programming

Why does this example C code run and yet SHOULD either not compile or give a segmentation fault?

Apologies for any typos... Well guys, been researching 'goto' in C and they say that you can't 'goto' labels in another function as a segmentation fault will occur. However I have found a way to 'goto' a label in another function that is NOT main() using the asm() function. As you know I... (14 Replies)
Discussion started by: wisecracker
14 Replies
IM-SWITCH(8)						      System Manager's Manual						      IM-SWITCH(8)

NAME
im-switch - set up input method for X Window SYNOPSIS
im-switch [-v][-z ll_CC] -s inputmethodname im-switch [-v][-z ll_CC] -c im-switch [-v][-z ll_CC] -a im-switch [-v][-z ll_CC] -l im-switch -h im-switch DESCRIPTION
This manual page very briefly documents the im-switch command. The im-switch command provides the framework to configure and to switch the input method on X Window System depending on the locale. This input method is the essential mechanism for Japanese, Chinese and Korean (CJK) languages to enter their non-ASCII native characters. Some input methods such as IBus, SCIM, and uim support not only one of these CJK languages but support almost all languages simultaneously by dynamically switching keyboard modes with GUI. The most desirable input method is provided as the configurable system wide default using Debian alternatives mechanism with /etc/alterna- tives/xinput-ll_CC link. The X start up code sources /etc/X11/Xsession.d/90im-switch which read the configuration file and activates the input method. The user configuration files and links are located in ~/.xinput.d/ . The system configuration files and links are located in /etc/X11/xinit/xin- put.d/ . This structure ensures to have different input methods to be installed side-by-side. im-switch understands the following options: -v Display verbose message during execution. -z ll_CC Set up the input method for X run under ll_CC locale (ISO 639 / ISO 3188). When changing the fallback default for all locales, use all_ALL as the quasi-locale value here. The setup by this all_ALL does not override specific setups. -s inputmethodname Set up the input method to use inputmethodname. -c Configure the input method with menu. (Under X, this uses GUI.) -a Reset the input method to the system default. -l List the input method configuration. -h Print a help message to the standard output and exit. When the im-switch command is invoked without any command arguments, it functions as -c option case. This is meant to be used by the GUI menu. SEE ALSO
update-alternatives(8) /usr/share/doc/im-switch/README.Debian /etc/X11/xinit/xinput.d/default AUTHOR
This manual page was written by Osamu Aoki <osamu@debian.org>, for the Debian GNU/Linux system (but may be used by others). IM-SWITCH(8)
All times are GMT -4. The time now is 03:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy