76 Topics
| |
Hello, this is my first post here. I'm playing around with Gtk+ and Xlib. I'm trying to get the X window ID of the active window, and then display that ID in a Gtk label. However, when I run it, it seg faults. I've narrowed it down to `XGetInputFocus`, but … | |
guys, I am implementing hash function in below code snippet but unfortunetly getting segmentation fault. Could you please help me to understand that what went wrong in this implementation. #include<stdio.h> #include<string.h> #include<stdlib.h> unsigned long hash(char** str ) { unsigned long hash_val = 5381; unsigned long sum=0; char* val ; int … | |
Here is the mex code I wrote to read in a tab-delimited file. The mex file got created but it causes my MATLAB to end abruptly and give the following error. Can anyone help me where I am going wrong? Please let me know if any further information is required … | |
Hello. I need to set up some pipes for a homework assignment as part of a bigger project. The issue I'm having is that the array (args) I'm using to populate the pipe arguments keeps segfaulting and I don't know why. Everything has been malloced beforehand and the faults only … | |
This is more of a tale of "I think I broke it". Basically as an assignment for CS I have to write an assembler for a subset of the MIPS assembly language. Currently it is not working, getting a sigseg, so I decided to debug the code and step through … | |
Hey I have an code in Qt that is an QPushButton is hidden at start of the cpp but later i want to get it appear when the file is open and an line is readed but the problem i get an segmentation fault. Can be because the setHidden(true) in … | |
I's running this on visual c++ and it runs without error. However, when I tried to run this on Linux, it kept giving me this "segmentation fault" message without any output. There is no pointer and is a quite simple program so can anyone please tell me what is wrong?? … | |
Im having some trouble putting together a linked list implementation of a queue. I'm getting a segmentation fault, which I believe is due to my empty() function because in an attempt to fix my empty() function, I made it determine empty based on (current_size == 0) instead of (front_p == … | |
Hello, I am writing a program that reads in data from a text file and puts it into a linked list. Certain variables are read in only if the "officeHeld" number is a particular number, otherwise the variable is set to 0. When I run this through Visual Studio, I … | |
Hey guys, I'm loading from a dictionary with a variable called "buffer". I'm trying to copy "buffer" in to another array word for word. For some reason, when I try using `strncpy()`, it yields a segfault. Here is my code (assuming "LETTERS" is 29: bool load(string filename) { // open … | |
Hey guys, I'm working with `strchr` and, for some reason, am getting a segfault. My program takes a string, iterates through the characters of that string, and adds a score to the "game" based on what letter the current character is. That sounds complicated, but my code will explain it: … | |
Hi, I'm new to C++. plzz help me with this error. #include <cstdlib> #include <iostream> #define clauselength 85 //we will use index number to find out the clause number. //there are 88 clauses. as we start using index from 1 we have to add one to 89. using namespace std; … | |
plz help me to solve the error in this program : Given programs replaces multiple spaces with only one space... there is no error , but it shows "Segmentation Fault"...whats the issue ????????? #include<stdio.h> int main(void) { char *t="ALOK KUMAR ASHISH KUMAR ANKUSH"; char *c; int n1=0; while (*t) { … | |
#include <stdio.h> #include <stdlib.h> long i,j,k,*ni,qi,a,*arr,n,q,p,no,c=0,m,max=0; int main() { ni = malloc(sizeof(long) * 100000); arr=malloc(sizeof(long)*10000); scanf("%ld",&no); for(i=1;i<=no;i++) { scanf("%ld %ld",&n,&qi); for(j=1;j<=n;j++) { scanf("%ld",&ni[j]); } for(k=1;k<=qi;k++) { scanf("%ld %ld %ld",&a,&p,&q); while(p<=q) { arr[++c]=ni[p++]^a; } for(m=1;m<=c;m++) { if(arr[m]>max) { max=arr[m]; } } printf("\n%ld",max); max=0; c=0; } } return 0; } Bold Text … | |
Hello all! I have used this forum many times in the past to solve a variety of programming related problems, but am truly stumped on a segfault within a binary search tree. I have isolated the segfault to a fscanf statement that look legitamate to me. The following code blocks … | |
I don't really have an explanation and whoever thought that this new posting format was the way to go... idk what to say. I really don't like it. I can only post so much lines of code before something happens to the window and I can't scroll all the way … | |
Hi all !! I am new to Fortran. Please see the following code: program exp_realloc implicit none integer,allocatable,dimension(:,:):: array integer::i,j allocate(array(3,3)) write(*,*)size(array,1)," ",size(array,2) do i=1,3 do j=1,3 array(i,j)=i*j write(*,*)array(i,j) enddo write(*,*) enddo CALL func(array) end program exp_realloc subroutine func(array) integer,dimension(:,:),intent(in)::array integer::i,j write(*,*)"********* Inside subroutine **********" write(*,*)size(array,1)," ",size(array,2) write(*,*)array(1,1) write(*,*)array(1,2) write(*,*)array(2,1) … | |
main.c #include <stdio.h> #include <stdlib.h> #define MAX_USERS 100 typedef struct Utilizadores{ char *login; char *pwd; } USERS; void ReadUsers(USERS user[]); int u = 0; int main(){ USERS user[MAX_USERS]; ReadUsers(user); return 0; } void ReadUsers(USERS user[]){ FILE *fp; fp = fopen("/home/Jiwe/Desktop/users.txt", "r"); while(fscanf(fp, "%s[^=]=%s\n", user[u].login, user[u].pwd) != EOF){ u++; } fclose(fp); … | |
I was wandering what could be the causes of this error message? Like in general. `\\: *stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault",frame={addr="0x00402d53",func="Domain::Movie::show",args=[{name="this",value="0x1"}],file="..\\src\\Domain\\Movie.cpp",fullname="e:\\eclipse for c++\\workspace\\lb6-8oop\\src\\domain\\Movie.cpp",line="36"},thread-id="1",stopped-threads="all"` 10x. | |
#include<stdio.h> int strlen_(const char *string); int strlen_(const char *string) { int length; for(length = 0; *string != '\0'; string++){ length++; } return length; } char *strcat_(char *string1, const char *string2); char *strcat_(char *string1, const char *string2) { char *p = string1; if(string1 == NULL || string2 == NULL) return string1; … | |
hi all, total noob here with assembly. I'm working on a project for one my classes and for some reason we all keep getting segmentation faults when attempting to run the program. I can't for the life of me figure out what the heck is going on and why this … | |
[code]for(int i=0;i<=c;i++) { l=0; if(strcmp(findedge(tst[i],dfa[0][j]),"null")!=0) { strcpy(t1,findedge(tst[i],dfa[0][j])); //l=strlen(temp); strcat(temp,","); strcat(temp,t1); //temp[l+1]='\0'; //temp[l]=','; } } [/code] When I try to append comma or some other symbol to temp, a segmentation fault occurs. If that step is omitted everything works perfectly. This is code is from my program to convert NFA to … | |
Hi, I have a task to perform which all to do with the smurfs, reading from a file and doing some simple stuff to it. The last part I need to do is print out a list of all smurfs and their corresponding role in alphabetical order. I am hoping … | |
Here are program instructions. IT SAYS "segmentation fault" WHEN RAN. Specifications You must create a Ship class: The Ship class maintains the position data for each ship/vessel and its distance from another Ship. It has a default constructor, which sets all of the member data to zero, and a non-default … | |
Hi this my first post here XD Its like this i have the code writen but it gives me this error Segmentation fault (core dumped) Can anyone tell me why? [code] MAX_BUFFER equ 10240 ; Constante que sera' usada como tamanho maximo de cada linha lida do teclado (10kb) FICH_ABERTURA … | |
I'm writing a program to convert Decimal numbers to binary, hexadecimal, and BCD as a refresher before i start getting code assignments in school. I'm almost done, but i have a seg_fault (compiler says decToHex function) in 1 function and i am hoping for some feedback on the others. I'll … | |
[I]To make it easier to read, only the relevant code is below, and due to circumstances beyond my control im stuck using Xcode for the next week or so (hate this debugger).[/I] I need help fixing a seg_fault in my current program. It occurs the last time "buildPaths" is called. … | |
I’m creating a program that displays random lines from a file. I have 8 lines on my text file and after displaying the last/8th random line… it displays [B][I]Segmentation fault[/I][/B] and then terminates the program. The program should display a message saying that there are no lines left to display. … | |
Please help me fix my code.. It works in CodeBlocks but when I try in Linux, it says it has an error - SEGMENTATION FAULT (core dumped) :( This program converts between bases of a number. After it converts a number it should go back to start to get input … | |
so i have this program written and i am getting a seg fault and the stack said in operator<<. I have no idea how to fix this...It is due in thirty minutes if someone can please help me asap. Here is where i think the problem lies: [CODE]#include <iostream> #include … |
The End.