19,876 Topics

Member Avatar for
Member Avatar for SpyrosMet

Hi everybody. I need to pass the value of a pointer to a struct for a server program to a client program. my code is the following for the server: [CODE] write(ns, &fixedparkpnt, sizeof(fixedparkpnt)); write(ns, &fixeddriverpnt, sizeof(fixeddriverpnt));[/CODE] and for the client: [CODE] read(sock2, &fixedparkpnt, sizeof(fixedparkpnt)); read(sock2, &fixeddriverpnt, sizeof(fixeddriverpnt)); [/CODE] sock2 …

Member Avatar for SpyrosMet
0
156
Member Avatar for kapilsolanki84

if u want to invoke the gnuplot with c then your code should be in this pattern. [CODE]FILE*gnuplot; gnuplot= popen("E:\\gp442win32\\gnuplot\\binary\\gnuplot -persist","w"); fprintf(gnuplot,"plot 'output.DAT'\n"); fprintf(gnuplot,"set title 'Po(db) v/s step/(km)'\n"); fprintf(gnuplot,"set xlabel 'step(km)'\n"); fprintf(gnuplot,"set ylabel 'Po(db)'\n"); fflush(gnuplot); close(gnuplot);[/CODE]

Member Avatar for progneer.soft
0
81
Member Avatar for MK1985

Hi All, In c programming we get [B]Debug assertion failed application error[/B] when we use malloc() and free() functions so anyone know about this error..? and why we get this error..? Thanks

Member Avatar for Ancient Dragon
0
103
Member Avatar for jamesonh20

So I have a working media player that I built in C# with MSVS 2008. I have a feature that loads pics into a pictureBox. How can I possibly manipulate the bounds of the box to make it a circle, or an abstract object? I am aware of how to …

Member Avatar for kvprajapati
0
77
Member Avatar for BLUEC0RE

I have numbers represented as chars (eg. '11.27') I want to type cast it to a double but im getting "pointer value used where a floating point value was expected". Any ideas?

Member Avatar for BLUEC0RE
0
71
Member Avatar for nonshatter

Hi all, I have virtually no knowledge of C, but I have a problem with one of my scripts. It runs fine on a 64-bit Linux machine, yet it gives me a seg fault when run on 32-bit linux. gdb tells me that the seg fault occurs on line 314. …

Member Avatar for mitrmkar
0
116
Member Avatar for jaku78

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 …

Member Avatar for mitrmkar
0
147
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
962
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
130
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
303
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
116
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
82
Member Avatar for nickcolb

I am in dire need of help. I have written this program to output the first 4 perfect number, numbers whose divisors can be added to produce the original number, and the code just sits there and does nothing when ran. [CODE]#include<iostream> using namespace std; int main() { int counter=1; …

Member Avatar for griswolf
0
135
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
108
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
148
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
61
Member Avatar for sharifyboy7

Implement a class SortedList as defined by the following skeleton: [CODE] #define MAX_ITEMS 10 typedef float ItemType; class SortedList { private: int length; ItemType values[MAX_ITEMS]; int currentPos; public: SortedList( ); // default constructor: lenght=0, currentPos=-1 void MakeEmpty; // let length=0 void InsertItem(ItemType x); // insert x into the list void …

Member Avatar for Fbody
0
355
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
155
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
74
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
112
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
167
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
78
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
116
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
217
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
201
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
128
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
320
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
99
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
143
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
150
Member Avatar for Finarfin34

I am developing an application using Win32 GetOpenFileName win32 API. When the window opened even if I click cancel memory usage incredibly increases from 2 mb to 8 mb. What could be the reason of this behaviour? Thanks in advance.

Member Avatar for Ancient Dragon
0
247
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
101
Member Avatar for jeyadevi
Member Avatar for Ancient Dragon
-1
34
Member Avatar for jeyadevi

give some idea for project title inventory system in c language

0
50
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
237
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
128
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
211
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
101
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
158
Member Avatar for tutun01111
Member Avatar for Caeon
-2
96
Member Avatar for skiabox

I am trying to produce a random walk solution but I get some strange results. Here's the code : [CODE] #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <time.h> int main (int argc, const char * argv[]) { // insert code here... char myArray[10][10]; char letters[26] = {'A', 'B', 'C', 'D', …

Member Avatar for WaltP
0
152
Member Avatar for ashmew2

Hi , I am basically working on a snakes game in C++. I have managed to move the snake around on the screen with the WASD keys . The snake is a result of a looped putpixel() functions in the ancient graphics.h Borland file. I was hoping to find solution …

Member Avatar for Luciusduplantis
0
172
Member Avatar for DerLars

Hello everybody, I have spend the last 6 hours on trying to access a char * type within a static struct without success. I guess I use the pointers wrong but after trying "everything" I am pretty lost right now. So hopefuly someone of you can help me. I have …

Member Avatar for gerard4143
0
142
Member Avatar for Goshutu

my program is made to enter a matix,in which it finds all of the column`s minimum numbers which are[COLOR="Red"] >0[/COLOR] and then put them under the last row.i have sucseded entering the array and puting it out,but i think my IF is wrong somehow.I have tried initialising the last row …

Member Avatar for Goshutu
0
204
Member Avatar for coolshiva

hi everyone i need some example programs on UART in embedded c for atmega8 micro controller can anyone help me plzzzzzzz

0
136
Member Avatar for Rajdarji

[CODE]#include <stdio.h> #include <ctype.h> #include <string.h> #include <unistd.h> #include <libgen.h> #include <time.h> #include <errno.h> #include <ctype.h> #include <math.h> #include <float.h> #include <stdlib.h> static char * string_tok( char *str) { static char *next = NULL; if(str == NULL) { str = next; } else { next = str; } if(str == …

Member Avatar for invisal
0
127
Member Avatar for onus

I have used typedef in my C programs previously many times. So it is not new to me. I was reading through a header file linux-2.6/include/net/iw_handler.h and found following use of typedef [CODE=c]typedef int (*iw_handler)(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra); [/CODE]I was not able to …

Member Avatar for mitrmkar
0
117
Member Avatar for MK1985

Hi, I am using win2000 Operating system and using microsoft visual studio to develop my application and while running i am getting debug assertion failed error.

Member Avatar for Adak
0
36
Member Avatar for Tellalca

How is it possible to delete a byte ( char, int, double .. ) from a text file ? Suppose that the file.txt contains :"110Hello". And I want to delete "110" from the file leaving only the "Hello" part. How to do this without reading the whole file into the …

Member Avatar for WaltP
0
74
Member Avatar for littleCuteMaria

I am working on a control break algorithm in C, and part of this algorithm is to have while loop check for the end of file and whether two strings equal each other. the first string is a part of a typedef struct structure called 'record' [I]rec.state[/I], and the second …

Member Avatar for Ancient Dragon
0
123

The End.