15,550 Topics

Member Avatar for
Member Avatar for yuri1969

Hi, I have been struggling with Valgrind's error in this function: [CODE]void parse_date(char *date_out) { char *date_in = __DATE__; int month = 0, day = 0; char *str_month = (char*) malloc(sizeof(char) * 4); char *str_day = (char*) malloc(sizeof(char) * 3); /* check mallocs */ if ((str_day == NULL) || (str_month …

Member Avatar for yuri1969
0
940
Member Avatar for rafi1082

i need to write a program that get the argument through argv[] and do a checksum to the input files where: argv[1]-the program to run eg.md5sum argv[2]-the output file with all results argv[3..]- the files the program need to run all checks in parallel using fork() an the output file …

Member Avatar for rafi1082
0
123
Member Avatar for madval88

Yeah this is a simple question and pretty popular. And this is what I did. There is a segmentation fault when we copy characters from [ICODE]src [/ICODE]into [ICODE]dest[/ICODE]. Now, I can understand the source of this fault - when we iterate over the [ICODE]dest [/ICODE]string we reach the end and …

Member Avatar for Ancient Dragon
0
300
Member Avatar for Alerwiali

Can some one tell me where the string is stored ,and there is only singed char c variable please explain "" my understanding is that it reads a character checks it and prints it then read the coming one !! #include<stdio.h> #include<ctype.h> main(){ int cnt=0; signed char c; printf("***Print Identifiers***\n\n"); …

Member Avatar for Adak
0
114
Member Avatar for subclass

Okay, to be honest, I don't know if its the free but thats where, after a lot of printf the code stops working. First off, I declare in main: unsigned char** imgSet and int n=0. [CODE] void loadImage(unsigned char*** imgSet, int *n) { char fileName[80]; printf("Enter filename: "); scanf("%s",fileName); addImage(imgSet,&(*n)); …

Member Avatar for Adak
0
80
Member Avatar for BadPointer

Hello guys, been struggling with implementing a linked list. I'm using this function AddToList to add elements. I'm clearly doing something wrong because no new element is added. Although when Im using a breakpoint inside the function i see that it seems right. [CODE] /* Main.cpp */ #include "LankadLista.h" #include …

Member Avatar for BadPointer
0
107
Member Avatar for MarounMaroun

Hello all, I have this struct: [CODE=c] typedef struct cell { char _name[2]; int _calcResult; int _depend[MAX_CELLS]; } Cell; [/CODE] and this is my main: [CODE=c] int main(int argc, char* argv[]) { FILE *fp; int i; fp=fopen(argv[1], "r"); Cell Cells[MAX_CELLS]; fillNames(fp,Cells); for(i=0;i<4;i++) printf("%s\n", Cells[i]->_name); } [/CODE] [CODE] static void fillNames(FILE* …

Member Avatar for sree_ec
0
145
Member Avatar for logicmonster

Is there a way to evaluate cosecant^2 in c? As far as I know, it isn't included in the math.h library, but could there perhaps be another one that it is included in?

Member Avatar for WaltP
0
58
Member Avatar for bufospro

Hi all, I am trying to make a program but I have a problem. So I can't continue. I am using a struct like that : [CODE]typedef struct account { char fullname[40]; int id; int amount; char name[15]; } account; typedef struct parking_system { int pos; char name[15]; char description[80]; …

Member Avatar for dgreene1210
0
152
Member Avatar for aplh_ucsc

hey guys! I need to know how to use pthreads with mutex to protect the critical section!!

Member Avatar for aplh_ucsc
0
70
Member Avatar for kimlong008

Help me ! I want to write code read file txt and I want to get each value of arry in file txt, but I don't know get it ! ex : In my file txt have : [CODE][COLOR="Red"]10/30/2010 10:42:48 PM[/COLOR][COLOR="Green"] 19,955.40 19,996.19 20,745.54 3,822.54 28,418.70 32,576.54 2,632.80 468.79 252.42 …

Member Avatar for kimlong008
0
111
Member Avatar for LiquidSolid

Hi I need to figure out how to make a histogram for a set of data (scores). I need it to display something like A: *** B: ** C: ****** D: * F: **** Here is my function for adding in the scores [code] int addGrades(int grades[], int num_grades) { …

Member Avatar for Adak
0
158
Member Avatar for berwick53

How would I make a 2d array of strings and how would I convert a string to an Int ?? Please Help..

Member Avatar for Adak
0
76
Member Avatar for y9john

Hi guys, I am working on a program for my c class and I was wondering anyone knows if it is possible to define a structure that has dynamic members. I think I saw a thread on this already but when I read it, it didn't quite make sense. This …

Member Avatar for y9john
0
114
Member Avatar for Agnusmaximus

Hi guys. I'm trying to find a good open source project written in C (any kind: email, browser, chat program, communications program, music player) to download for the Mac os X preferably for Xcode. I would like to examine these open source programs' source and understand what they do (pick …

Member Avatar for Agnusmaximus
0
215
Member Avatar for SpyrosMet

Hi everyone. i have an issue with a server program i'm developing for a university project. The issue is the following: The server program i'm building uses shared memory and forks. However i have a problem as to how can i destroy the shared memory segments i've created. A simplified …

Member Avatar for SpyrosMet
0
199
Member Avatar for yuri1969

My func looks like: [CODE]int pop(node **hd, char **new_element) { node *dummy; int i = 0; if (empty(*hd) == 1) { printf("Stack is empty"); return -1; } else { (*new_element)[i] = (*hd)->element[i]; // problem is here ;) dummy = *hd; *hd = (*hd)->next; free(dummy); }[/CODE] and I call it via: …

Member Avatar for yuri1969
0
126
Member Avatar for d00mhammers

Hello everyone, this is my first time here on this website and forum, and after reading through some of it, I think it's very helpful, so I would like to say thank you. I am facing a problem that I have been trying to solve for a few days so …

Member Avatar for arnab sinha
0
314
Member Avatar for LiquidSolid

Right now I need help adding numbers into an array. The function I have is not in the main function and the array parameters are passed by reference. Using something like [code]int add ( int grades[], int number_grades ) [/code] I need to have it so it will allow someone …

Member Avatar for LiquidSolid
0
95
Member Avatar for kapilsolanki84

if u want to create a file using a variable by taking its value from input data file,then your code should be in this pattern. [CODE]char ch[10];/*say input.dat contains data as 'output'*/ FILE*fp,*ft; fp=fopen("input.dat","r");/*fp is input file pointer*/ if(fp==NULL) { puts("error") } while(fscanf(fp,"%s",&ch)!=EOF); printf("%s",ch); sscanf or sprintf(ch,"%s.txt",ch); ft=fopen(ch,"w"); if(ft==NULL) { …

Member Avatar for WaltP
-1
141
Member Avatar for gahhon

[CODE] if(Student[i].regNo.campus == "KUALA LUMPUR") Student[i].regNo.campus = 'W'; else if(Student[i].regNo.campus == "PERAK") Student[i].regNo.campus = 'a'; else if(Student[i].regNo.campus == "PENANG") Student[i].regNo.campus = 'b'; else if(Student[i].regNo.campus == "JOHOR") Student[i].regNo.campus = 'c'; else if(Student[i].regNo.campus == "PAHANG") Student[i].regNo.campus = 'd'; else if(Student[i].regNo.campus == "SABAH") Student[i].regNo.campus = 'e'; [/CODE] i got alot of warning message …

Member Avatar for gahhon
0
148
Member Avatar for vishalarora91

I want to use the outtextxy() for the output of my program in the graphical mode,but the complier gives error when it encounters a variable in the outtextxy() as an argument. Suggest me how to slove this. for eg: [code] for(i=0;i<=3;i++) { outtextxy(100,200,i); setcolor(0); setfillstyle(SOLID_FILL,BLACK); bar(50, 50, 590, 430); } …

Member Avatar for armadillodesing
0
98
Member Avatar for jeyadevi
Member Avatar for Ancient Dragon
-1
31
Member Avatar for jeyadevi

give some idea for project title inventory system in c language

0
48
Member Avatar for Agnusmaximus

Hi guys, I'm new to this site and I have a question regarding internet bots in general. What I want to do is to use C (or php) to create a bot that will scan the internet (perhaps log into sites, retrieve data, get links, play internet games?) on the …

Member Avatar for Agnusmaximus
0
233
Member Avatar for hussamat

[code] * Asuming the list is sorted in ascending order, inserts n in the list * at the right position to maintain the ascending and returns the resulted list. */ struct node * insert (int n, struct node * list){ struct node * newnode = (struct node *) malloc (sizeof(struct …

Member Avatar for abhimanipal
0
126
Member Avatar for Teelnaw

New to the forum and C. I am trying to write a function that will allow me to remove a certian string from and exisiting one. The below program I wrote by using examples in an text book and online. I understand it at a basic level, but I'm pretty …

Member Avatar for abhimanipal
0
208
Member Avatar for a-humam

Hello All I need to write a program in C standard to solve the produce -consumer problem but I don't want to use threads, also I don't want to use Semaphore or shared memory. The exactly I need is to write the program using (Message queue) which use functions of …

Member Avatar for group256
0
100
Member Avatar for dragonpunch

hello how do i open zip and rar files with c ? which lib do u recommend ? is there any one lib that does both zip n rar ? im basically trying to open zip and rar files which contain pics and retrieve a string array of all the …

Member Avatar for Ninetie
0
156
Member Avatar for tutun01111
Member Avatar for Caeon
-2
93

The End.