15,551 Topics
| |
Ok basically I have a program that is doing a counter clockwise spiral and will print the value i or print out a 0 depending upon if the number is prime. n is equal the length of the spiral while i is the initial center value of the spiral which … | |
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 … | |
| 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 … |
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 … | |
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"); … | |
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)); … | |
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 … | |
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* … | |
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? | |
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]; … | |
hey guys! I need to know how to use pthreads with mutex to protect the critical section!! | |
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 … | |
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) { … | |
How would I make a 2d array of strings and how would I convert a string to an Int ?? Please Help.. | |
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 … | |
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 … | |
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 … | |
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: … | |
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 … | |
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 … | |
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) { … | |
[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 … | |
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); } … | |
it is a project title pls send any other new ideas implement in this project | |
| |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … |
The End.