15,551 Topics

Member Avatar for
Member Avatar for sgriffiths

Hi I have a struct [code] struct s_list { char name[30]; char lowest[30]; int int_value; }LIST[100]; [/code] I want to pass the int_value to a the unix function qsort, but how do i pass structs to a function/procedure? regards

Member Avatar for ~s.o.s~
0
689
Member Avatar for slacke

Hi I'm trying to create and use some basic socket. I made a code but the compiler reports an error. I'm using linux ( sys/socket.h library) The code is> [CODE] #include <iostream> #include <cstdlib> #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> #include <arpa/inet.h> #include <signal.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> …

Member Avatar for slacke
0
112
Member Avatar for Panda123

Hello Im trying to segment a big file (200mb) into smaller packets so i can transmit over TCP/IP but im clueless how to do it. Can anyone help me please. Using the borland builder Thanks

Member Avatar for Ancient Dragon
0
138
Member Avatar for degamer106

One of the things I can't get working is reading and writing a structure to and from a file in binary. I'm sure that I'm using fread and fwrite correctly. However, I keep getting crashes which I cannot find ways to debug. [CODE]#include <stdio.h> #define MAX 1 typedef struct { …

Member Avatar for degamer106
0
256
Member Avatar for proteusx

I'm in the middle of a project using a mysql database and spanning several languages. A problem has arisen that we need a piece of it to be in C, that reads in a query, replaces some placeholders (wrapped in '?' chars), and then runs said query. The problem here …

Member Avatar for proteusx
0
429
Member Avatar for dilip.mathews

Why cant we have a virtual constructor? All the materials give somewhat similar anwer to this question. "First the VPTR Pointer is initialised to it's proper VTABLE by the contructor which is automatically done by the compiler ,,,," or "You don’t ever want to be able to make a call …

Member Avatar for Laiq Ahmed
0
154
Member Avatar for degamer106

Hi. I can't a small part of this program to work correctly; the square root function either returns a bunch of funny symbols OR it returns 0.00 On a side note, I have 2 questions: 1) If you have a structure nesting two other data structure types (like in my …

Member Avatar for degamer106
0
162
Member Avatar for anupamjamatia

[CODE]#include<stdio.h> #include<conio.h> #include<math.h> main() { float a,b,c,d,k,x,y; clrscr(); printf("Enetr the values of a,b,c=>"); scanf("%f %f %f",&a,&b,&c); d=((b*b)-(4*a*c)); k=sqrt(d); x= (-b+k)/(2*a); y= (-b-k)/(2*a); printf("The quadratic equation is x=%f and y=%f",x,y); getch(); } [/CODE] but after compiling the result is look like this .....why .... wnter the values of a,b,c=>6 5 4 …

Member Avatar for dwks
0
213
Member Avatar for sgriffiths

Hello i have a a struct which contains the below 1 10 11 2 3 But i need this to be in numeric order, ie 1 2 3 10 11 below is my code [code] do { fprintf(fReport, "List Name = %d\n", LIST[t].name ); t++; } while( t != k …

Member Avatar for dwks
0
140
Member Avatar for comp_sci11

[code] #include <stdio.h> int arrange(int[],int); main() { int array[10],num,i,flag; clrscr(); puts("Enter length of array"); scanf("%d",&num); puts("Enter the enties:"); for( i=0; i<=num-1; i++) { printf("\n(%d).......",i+1); scanf("%d",&array[i]); } do { flag=arrange(array,num); }while( flag==-1); printf("\nThe array in desending order is: "); for(i=0; i<=num-1; i++) printf("\n\t\t***** %3d *****",array[i]); getch(); } int arrange(int *block,int num) …

Member Avatar for dwks
0
263
Member Avatar for dev.cplusplus

:mrgreen: Hi to all, I have a challange in my work, we have a project that uses a variable of type "CMapStringToPtr", this object is use to store some data, now we want to change the type to more efective type, the problem is that we need to know if …

Member Avatar for Laiq Ahmed
0
442
Member Avatar for dev.cplusplus

Hi to all, I need your help, I need to sort a CList, I was wandering if you can help me in this issue. Wich is the best way to sort CList and How to manage the pointer? Thanks :rolleyes:

Member Avatar for Grunt
0
68
Member Avatar for newbie2k6

I was wondering if someone can show me how to do a fade in and fade out text effect using c.i tried couple of techniques using delay function and changing up the text color but doest come up right:sad:

Member Avatar for b2daj
0
75
Member Avatar for LearninKaz

Hey, I need help with finding out if BSTs are height and size balanced, Ive got plenty of books and people telling me different things but i need it to click in my own head! Any ideas or simple ways of doing it? Thankyas!

Member Avatar for b2daj
0
115
Member Avatar for jaininaveen

hi everyone,:cool: I like to work on accessing internet(that means get a web site content) with my c code. so plz tell me a possible way to send reqest to a perticular web site and get the information....:rolleyes:

Member Avatar for jaininaveen
0
233
Member Avatar for cyan033

hi guys, first time posting here :cheesy: i have problems with my assignment.. Here is a piece of code inside my main function, I have to convert decimal number to binary. I take decimal numbers divide by 2, and strcat() the remaining, then use a function strrev() to reverse it …

Member Avatar for dwks
0
144
Member Avatar for rbabakuliyev
Member Avatar for Grunt
0
106
Member Avatar for sgriffiths

hello I have a program which is being passed 2 lines items at a time To hold these lines i have 2 static pointers, these are:- static char *first_string=NULL; static char *second_string=NULL; These 2 lines will contain data such as:- A1|VALETING|LIMITED A2|COMPANY|VALET|LTD I then use strtok to move through each …

Member Avatar for jim mcnamara
0
230
Member Avatar for Shital Parab

How to swap two variables without using a third variable & pointer?

Member Avatar for Salem
0
218
Member Avatar for cgerber

I'm either missing something small or theres a BIG problem somewhere. The following code compiles sucessfully with [B]g++ 4.1.0[/B] under [B]SuSE 10.1 i586 [/B][I](Linux 2.6.16.13-4-default i686) [/I]but it gives a Segmentation Fault when I run it. [code] #include <stdio.h> #include <list> typedef struct { std::list<int> b; } data; int main(int …

Member Avatar for WaltP
0
102
Member Avatar for dilip.mathews

[code]#include <stdio.h> #define a b #define b a int main(void) { int a = 20, b = 30; printf("%d %d", a, b); } [/code] What will be the output of this programm ?????????????? Really confused with this ... Can somebody tell me what exactly will be happen and how macros …

Member Avatar for WaltP
0
226
Member Avatar for comp_sci11

[code]#include<stdio.h> #include<string.h> #define size 21 #define max 5 int id[max][size]; char ln[max]; int pr[max]; int mt[max]; int fg[max]; void getrecord() { int i; for(i=0;i<=4;i++) { clrscr(); printf("id number:"); scanf("%d",id[i]); printf("last name:"); scanf("%s",ln[i]); printf("prelim:"); scanf("%d",pr[i]); printf("midterm:"); scanf("%d",mt[i]); fg[i]=(pr[i]*0.4)+(mt[i]*0.6); } getch(); } void displayreverse() { int i,p; clrscr(); printf(" idno. lstnme prelim …

Member Avatar for Ancient Dragon
0
154
Member Avatar for rxgmoral

Ask Function problem?thanks <<<<<<<<<<Class.h>>>>>>>>>> [code] #pragma once class Class { public: int get_return(int a,int b,int (*compare)()); int Rxgmoral(int a,int b); void Fun(); };[/code] <<<<<<<<<Class.Cpp>>>>>>>> [code] #include "Stdafx.h" #include "Class.h" int Class::get_return(int a,int b,int(* compare)()) { return (compare(a,b)); } int Class::Rxgmoral(int a, int b) { return a+b; } void Class::Fun() { …

Member Avatar for rxgmoral
0
141
Member Avatar for mitchelltab

[COLOR=black]This is the program. Re-using the tuition calculations from Lab1, and write a program to do the following:[/COLOR] [COLOR=black]Read student classifications and numbers of units from the [/COLOR][B][COLOR=black]data file [/COLOR][/B][COLOR=black]LAB2IN.TXT. (No error[/COLOR] [COLOR=black]checking of data read from input file is required.) Then write each student's resulting tuition to a[/COLOR] [COLOR=black]second …

Member Avatar for Dave Sinkula
0
183
Member Avatar for steven01

I want bundle a exe file to a software.can anyone suggest some place to find some softwares?

Member Avatar for Dave Sinkula
0
43
Member Avatar for Lun

is it possible to change the space into underline? coz i don't know how to program that in C... please help!!

Member Avatar for ~s.o.s~
0
100
Member Avatar for joshilay

int i=0,j=1; cout<<(j++)&&(i++); //output=1; i=0,j=1; printf("%d",(j++)&&(i++)); //output=0 can anyone please tell why this difference in output ???

Member Avatar for ~s.o.s~
0
88
Member Avatar for dilip.mathews

I have to write a function which takes an integer array as input and it should return true if the array contains 1,2,3 or 4. Conditions 1) The function should pass thru array only once. 2) Can use two local variable. 3) Preferably using bit manipulation. Now suppose if the …

Member Avatar for WolfPack
0
132
Member Avatar for bkelly

Two questions: 1. What function will output N bytes of data? The data may contain and may end with numeric zero. 2. What function will cause the process to suspend for N milliseconds? An explanation for question 1. [code] struct modbus_structure { char device_address; char function_code; UINT function_address; UINT address; …

Member Avatar for Dave Sinkula
0
257
Member Avatar for knorden

Hi all. I am new to C, at least to the concept of pointers. I am trying to write a process scheduling simulator for my operating systems class (at the last minute of course). Anyway, I wrote a program just using arrays and got it to compile but then of …

Member Avatar for knorden
0
109

The End.