15,552 Topics

Member Avatar for
Member Avatar for Dewey1040

I've attempted to create a linker for assembly files, what the program does is not the issue here though, I havent used pointer arithmetic in a few years and am definitely rusty in doing so. I'm getting a segmentation fault when I attempt to run the file and would like …

Member Avatar for Dewey1040
0
168
Member Avatar for Brasa619

Im suppose to have this prompt me via stderr to enter two 32-bit keys. I use fgets tofrom stdin to read up the line the user inputs. Then im suppose to parse the line into tokens using strtok_r that converts them to unsigned longs. I already have a function strToULong.c …

Member Avatar for DeanMSands3
0
180
Member Avatar for iwanna mix-mix

it gets compiled but it crushes: "programm has stopped working" Please help me!!! this is the programm: #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { FILE *fp; int i=0, n; char allwords[100][40]; fp=fopen("fraoules.txt","r"); if ( (fp=fopen("fraoules.txt","r") )==NULL ){ printf("To arxeio den mporese na anoixtei\n"); } while(strcmp( allwords[i],"telos")!=0){ fscanf(fp, …

Member Avatar for TrustyTony
0
193
Member Avatar for hwoarang69

trying to create fifo that can read and write. but some reason its not going below "O_RDONLY" line. any thoughts? char *fifo_name = "fifo"; #define 0666 int main() { int fd1; int fd2; //create fifo if(mkfifo(fifo_name,FIFO_MODE) == -1) { exit(1); } //open fifo for read if((fd1 = open(fifo_name, O_RDONLY)) == …

Member Avatar for hwoarang69
0
153
Member Avatar for ghada ali

hi i try to build a project in c by using code::blocks but i get this result: vector_matrix multiplication - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping... Nothing to be done.

Member Avatar for Ancient Dragon
0
114
Member Avatar for Junior999

#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { FILE *file; char ch, str[500], a=0; char name[20], word[50], temp[50]; int i,lenght=0, b=0; if((file=fopen("sample.txt" , "r"))==NULL) { printf("Error while opening file\n"); system("pause"); exit(1); } while (!feof(file)) { fgets(str, 499, file); printf("%s\n",str); ch=fgetc(file); if(ch!=' ') { a++; word[b]=ch; if(a > lenght) lenght=a;f …

Member Avatar for Ancient Dragon
0
178
Member Avatar for lamba89

Hi everyone, I'm trying to parallelise a Gram-Schmidt algorithm. Here's the serial code: for( k = 0; k < m; k++ ) { for( i = 0; i < k; i++ ) { s = 0.0; for( j = 0; j < n; j++ ) { s += q[ i …

0
124
Member Avatar for mayank.dyl

what does fork() do in c.? Is it same as fork operation in OS ? What is the o/p of following program ? #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); }

Member Avatar for mayank.dyl
0
191
Member Avatar for jimjones371

Need help from daniweb community. I suck at programming. It doesn't make sense to me. I'm not going to be programming in my career but it's part of my major. I'm desperately trying to get an c- just to pass. Would love some help. I would appreciate some explanation but …

Member Avatar for gusano79
0
284
Member Avatar for Dewey1040

I'm trying to use the system call to append an arbitrary number of files to one specific file... when I attempt to run the program i get the error: sh: addints.o: not found sh: main.o: not found sh: rbyswt.o: not found sh: readint.o: not found sh: writeint.o: not found sh: …

Member Avatar for kings_mitra
0
97
Member Avatar for mrmikemike

Hi all, can someone please help me with my code: Its suppose to input a text file of values then display them and give the max and its index, and inputed values are floats. But I can seem to get the max right. Thanks #include <stdio.h> int main() { FILE …

Member Avatar for mrmikemike
0
162
Member Avatar for luvrahul30
Member Avatar for whtewa

The hash table stores phone numbers and names, uses the names as the keys. The problem I have is when I use the terminal window to enter the names and numbers. The strange problem that occurs then is that all the names get the same phone number. But when i …

Member Avatar for WaltP
0
210
Member Avatar for jaymayne

Its an exam question that wants to modify code so that the following output is generated 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 **This was the original code** #include<stdio.h> void main() { int i,j; for(i=1;i<5;i++) { for(j=1;j<=5;j++) { printf("%d",i); } printf("\n"); } …

Member Avatar for jaymayne
0
167
Member Avatar for yamigx

hi.. i am trying want to solve this Write a complete program that reads 11 integers from a file called ‘file.txt’ and stores them in an array. Your program should then remove the duplicated numbers, find and print the sum of all the even numbers in the array as well …

Member Avatar for TrustyTony
0
275
Member Avatar for Valiantangel

Hi, how do i output a list,1-5 of the following factorial? #include <stdio.h> #include <stdlib.h> #define fact 5 int main(void) { int i,result=1; for (i=fact;i>=1;i--) result*=i; printf("factorial of (%d) = %d\n", fact, result); return(EXIT_SUCCESS); }

Member Avatar for TrustyTony
0
90
Member Avatar for iPanda

I got this simple code: #include "stdio.h" #include "stdlib.h" #include "windows.h" int main(int argc, CHAR* argv[]) { HANDLE hFile = NULL; HANDLE hMapFile = NULL; LPBYTE fileView; hFile = CreateFile(argv[1],GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); if(hFile == INVALID_HANDLE_VALUE) { printf("CreateFile function failed\n"); goto clean; } ***** hMapFile = (LPBYTE)CreateFileMapping(hFile,NULL,PAGE_READONLY,0,256,NULL);***** if(hMapFile == NULL) { printf("CreateFileMapping function …

Member Avatar for BobS0327
0
1K
Member Avatar for Vish0203

Hi Everyone!! I'm facing a few problems in storing the structutres or records in a file. I'm trying to store the usernames and passwords(Taken as example), of a person in a single record as structure variable **w[99].** and **i=0 to i<=100 *** When the program Executes for the first time, …

Member Avatar for Vish0203
0
143
Member Avatar for srinidelite

Hello Everbody, I have 2 arrays called Array 1 Array 2 Stuid stuname stuid Bookname 1 Albie 1 OOPS 2 Morkel 2 CNA 3 Jmes 1 ComputerNw 3 OOPs 2 CNA Code: #include<stdio.h> main() { // char array1[2][1],array2[5][1]; char array1[100][100]={'ID1','srini','ID2','Albie','ID3','Kaasi'}; char array2[50][100]={'ID1','OOPS','ID2','STS','ID1','STS','ID1','CTC','ID3','MAT','ID2','MAT'}; printf("We're Begining the Comaprison Here !!\n\n"); search(array1[][],array2[][]); } …

Member Avatar for Sky_Flyer
0
281
Member Avatar for tiredoy

Dear guys, I get stuck in a basic problem that is often overlooked. Like this , I can write code in such way. 1.#include"stdio.h" 2.void main#void#{ 3. double x; 4. scanf#"%f",&x#; 5. printf#"%f",x#; 6. } When I input a number like 3.0 ,however the result is a minus number. I …

Member Avatar for zeroliken
0
115
Member Avatar for denethor

Hello do you know whats wrong with this code? #include <stdio.h> #include <allegro5\allegro5.h> #include <allegro5\allegro_primitives.h> #include <allegro5\allegro_image.h> int main() { al_init(); FILE* pFile; return 0; } If I compile it, it fails and output is: main.c 1>c:\users\beda\documents\visual studio 2010\projects\c allegro\c allegro\main.c(9): error C2143: syntax error : missing ';' before 'type' …

Member Avatar for Ancient Dragon
0
182
Member Avatar for garvit184

I need help in running a program that makes a SLR Parser Table. Here is the code : Code to find first and follow: saved as SLR.h #include<stdio.h> #include<ctype.h> #include<conio.h> #include<stdlib.h> #include<string.h> #include<iostream.h> #define epsilon '^' // since I didn't know how to type epsilon symbol temporily I am using …

0
561
Member Avatar for dan1992

How to make this program #include <stdio.h> #include <conio.h> #include <math.h> int main(){ clrscr(); for(i=0;i<10;i++) for(j=0;j<10;j++) printf("a[%d][%d] = %d \n",i,j,a[i][j]); printf("cu pointer\n"); for(i=0;i<10;i++) for(j=0;j<10;j++) printf("a[%d][%d] = %d \n",i,j,*(p+i)); getch(); } int a[4][4],b4[3][3],b1[3][3],b2[3][3],b3[3][3],n,c1,c2,c3,c4,i,j; printf("\nIntroduceti elementele Matricei cu 4 linii si 4 coloane: \n"); int *mat; n=4; for (i=0; i<n; i++){ for …

Member Avatar for dan1992
0
168
Member Avatar for Infame

Hello! I'm having a slight problem with a event... What I'm basically trying to do is: Activate a on button event, that fetches source code, then posts it within the edit window with "SetWindowText(hTextBox, get_source("website", "path"));". Sadly, this didn't quite work out that well, as I recieve a Run- Time …

Member Avatar for BobS0327
0
105
Member Avatar for RichardLim

I am a newbie in programming and I'm using visual studio. i typed in this #include <stdio.h> #include <conio.h> #define PI 3.1416 void main(void) { float radius, circumference, area; radius = 2.5; circumference = 2 * PI * radius; area = PI * radius * radius; printf("radius of a circle …

Member Avatar for BobS0327
-1
91
Member Avatar for literal

If I have to do the basic tree with these declarations typedef struct item { char petname[20]; char petkind[20]; } Item; typedef struct node { Item item; struct node * left; /* pointer to right branch */ struct node * right; /* pointer to left branch */ } Node; typedef …

Member Avatar for zeroliken
0
107
Member Avatar for hwoarang69

how to copy pointer to pointer. char *name1; //store the value of DAVE char *name2; if name2 was a array i would have done. strcpy(name2,name1); but i dont know how to copy pointer into pointer. i was thinking some thing like this. name2 = name1? also do i need to …

Member Avatar for Shardendu
0
174
Member Avatar for hwoarang69

trying to build linked list that sort it selft. but this code below doesnt work. this part of code should insert a node in order. for ex. if i have a linked list of age 1 3 4 5. and if i insert(3) than result should be 1 2 3 …

Member Avatar for gusano79
0
92
Member Avatar for alaa sam

hi everyone I'm working currently with linked list , and there's a problem with my code , the link is writing the same place every time (it replaces the previous values with the new ones without inserting a new one ) can anyone help ? Thanks in advance #include<stdio.h> #include<unistd.h> …

Member Avatar for Ancient Dragon
0
125
Member Avatar for Hitman Mania

Hey, this is one of the exam review questions, and I'm wondering how I would return 1 or 0 for bad input (i.e. cant divide by input 0) using return 0 and 1 if the function doesn't accept returns, i.e. void function (int variable) //cant have return statement. Here is …

Member Avatar for BobS0327
0
198

The End.