15,550 Topics

Member Avatar for
Member Avatar for Vorwerkj

I have this struct for an item in a to-do list [code=c] struct Task { char description[TASK_DESC_SIZE]; /* description of the task */ int priority; /* task priority */ }; [/code] i'm just not sure how to alter the description while making a task using this [code=c] TYPE createTask (int …

Member Avatar for Vorwerkj
0
119
Member Avatar for mcodesmart

[B]Simple Question: Please read[/B] I have the following code snippet from my program that i am working on [CODE] bit running = 0; float var1, average_value; void is_something_running(void) { if (fabs(var1 - average_value) <= 0.001){ return *(&running) = 0; } else return *(&running) = 1; }[/CODE] var1 and average value …

Member Avatar for Ancient Dragon
0
121
Member Avatar for shinsengumi

Can anyone help me improve my source code below? I tried fixing it but apparently, there's not much success. [CODE] #define NUM_THREADS1 1 void *go_to_website2(void *program); void *go_to_website1(void *program) { char* str[3]; str[0] = (char *)program; str[1] = "http://www.google.com"; //supposedly 2nd website to go to str[2] = '\0'; char* new_prog …

Member Avatar for sree_ec
0
908
Member Avatar for onus

I am trying to understand usage of keyword __attribute in C I have checked following two pages [url]http://unixwiz.net/techtips/gnu-c-attributes.html[/url] and this page also [url]http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html[/url] but still I could not understand where do I declare them and how I can use __attribute in my program. To test this I wrote a C …

Member Avatar for sree_ec
0
603
Member Avatar for shinsengumi

Hi everyone! I just want to ask, how do I use socket programming in C to open/go to web sites? I want to create a program that should look like this: the program asks for an integer input from the user and depending on the input number, the program invokes …

Member Avatar for Nick Evan
0
542
Member Avatar for fyezool
Member Avatar for onus

On this link [url]http://lxr.free-electrons.com/source/drivers/parport/parport_pc.c?v=2.6.29#L97[/url] they defined a structure superio_struct and initialized as [CODE=c]superios[NR_SUPERIOS] = { {0,},};[/CODE] I am not able to understand above initialization has what is it getting initialized to. What I deduce till now is superios is a structure array of struct superio_struct and NR_SUPERIOS is defined as …

Member Avatar for onus
0
106
Member Avatar for bkoper16

I am making a program that reads football player stats from a file and places it in an array how ever my program seems to over read the file which has the stats of 17 players and it makes an array of 101 players with the first 17 being alright …

Member Avatar for Perry31
0
186
Member Avatar for sing1006

i have a problem here. [CODE][/CODE] #include<stdio.h> int main (){ int counter; int x; int y; int product; counter=1; x=1; y=1; product=1; while (counter<=5){ printf("%d>%d\n",x,y); x=x+1; y=y+2; counter=counter+1; product=product*y; } printf("Product>%d",product); return 0; } well,the product should be 945.but what have printf out is 10395?what is the provlem inside the …

Member Avatar for sing1006
0
116
Member Avatar for sing1006

here is the things so far i got. [CODE][/CODE] #include <stdio.h> int CF(int C); int FC(int F); int main(){ printf("Fahrenheit equivalents of Celsius temperature\n"); printf("Celsius \t Fahrenheit \n"); for (x=0;x<=100;x++); printf("Celsius equivalents of Fahrenheit temperature\n"); printf("Fahrenheit \t Celsius \n"); for (x=32;x<=212;x++); Pls,somebody help me.T.T

Member Avatar for sing1006
0
283
Member Avatar for gahhon

first we read something from the text files ( INT type only ), then i want read till "\n" stop and inceasement a value, examples, [CODE] int Attendance[10][10]; ExistingFile = fopen("Attendance.txt", "w"); if(!ExistingFile) { printf("\t\t This File Cannot Be Open Successfully!!\n"); printf("\t\t Please Check It!!\n"); exit(-1); } else { fprintf(ExistingFile, …

Member Avatar for gahhon
0
177
Member Avatar for yuri1969

Hi, i have question about accept call interrupting. As you can see I have a loop which is controlled by boolean [B]not_ended[/B]. I set this var to 0 (false) in a separate function. I would like to know how should I [U]manage to interrupt this accept loop properly[/U]. When I …

Member Avatar for yuri1969
0
5K
Member Avatar for iarkey

[CODE]#include <stdio.h> #include <windows.h> #include <stdlib.h> DWORD WINAPI test_thread(LPVOID lpParam) { printf("thread whiiiii\n"); struct person { char *namee; int agee; }; struct person p = ((struct person)lpParam; printf("%s\n",p.agee); ExitThread(0); } int main() { struct person { char *name; int age; }; DWORD thread; struct person p; p.name = "John Smith"; …

Member Avatar for sree_ec
0
683
Member Avatar for letaki

Hello there, I have an issue with execvp to a project in C i'm trying to procces.. Execvp is always returning -1.. and this warning " passing argument 2 of ‘execvp’ from incompatible pointer type" .. here's the source code, and any advice at the matter would be appreciated! [CODE]#include …

Member Avatar for nezachem
0
1K
Member Avatar for CrazyDieter

I am trying to use Qt 4.0 with devCpp. I have a weird error when i try to compile this simple code : [code] #include <QtGui/QApplication> int main(int argc, char *argv[]) { QApplication qApp(argc, argv); return qApp.exec(); } [/code] The error is : [code] 10 : no matching function for …

Member Avatar for gerard4143
0
169
Member Avatar for bufospro

Hi, I have a problem with my code in C An error occurs with message : /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/crt1.o(.text+0x21): In function `_start': : undefined reference to `main' collect2: ld returned 1 exit status Does anyone know for it ? Thanks a lot

Member Avatar for sree_ec
0
994
Member Avatar for imyellowjacket

Hi everyone, I just got a problem referencing void pointer. If in my code, I replace *rbuf= &svar by (rbuf= &svar;); it does not complain but it does not return the real value (rbuf is a void pointer). Please Can anyone give me any advise. I would really apreciated /*****************************************************/ …

Member Avatar for imyellowjacket
0
4K
Member Avatar for niehaoma

The purpose of this is to obtain a genuine critique of my source code (based on a fairly simple concept). I realize I may not have the cleanest implementation for testing for prime, due to the fact I am not an aspiring mathematician. I am interested on critique of the …

Member Avatar for hsetaknev
1
188
Member Avatar for vvvvvv89

Hi all! I have been given the task to modify the code below so that it can do subtraction, multiplaction and division, not just addition. Could someone help me with this and explain what the strncpy does? I'm so confused!! // C Parsing Adder program #include <stdio.h> #include <string.h> // …

Member Avatar for Ancient Dragon
0
144
Member Avatar for D33wakar
Member Avatar for Ancient Dragon
0
65
Member Avatar for shinsengumi

Hi everyone! Does anyone here know how to create a C program that will open a web browser depending on the user input? For example if the user inputs the integer 1, the web browser will be opened and will go to 'http://www.daniweb.com', when the input is 2, 'http://www.google.com' will …

Member Avatar for decypher
0
4K
Member Avatar for Alerwiali

I am having a programming exam ,and we have studied arrays ,files ,and linkedlist ,hash tables ::the question is in what cases is the best choice to use one of these !! because most of the mark goes to how & what kind i used in implementing the program that …

0
58
Member Avatar for shinsengumi

Can anyone help me improve my source code below? I tried fixing it but apparently, there's not much success. [CODE] #define NUM_THREADS1 1 void *go_to_website2(void *program); void *go_to_website1(void *program) { char* str[3]; str[0] = (char *)program; str[1] = "http://www.google.com"; //supposedly 2nd website to go to str[2] = '\0'; char* new_prog …

Member Avatar for shinsengumi
0
198
Member Avatar for Joey_Brown

Hello. I have a question regarding a task I was given. It goes : Fill the array with random numbers and then print out how many times theyve appeared like so : [CODE] /* ARRAY : 0 0 0 0 1 1 1 2 2 2 2 2 6 6 …

Member Avatar for Joey_Brown
0
106
Member Avatar for indrajeet6

Hi all I've just downloaded the Visual C++ express 2010 from the microsoft website. but when i try to compile and run the program, it says: "Unable to start program 'C:\Documents and settings\Indrajeet Roy\My documents\Visual Studio 2010\Projects\First Prog.c\First prog.c.exe'. The system cannot find the file specified." What do I do …

Member Avatar for indrajeet6
0
443
Member Avatar for MarounMaroun

Hello guys.. I have this makefile: [CODE=c] MyMatrix‬‬: MyMatrix.o gcc MyMatrix.o -o MyMatrix MyMatrix.o: MyMatrix.c gcc -c MyMatrix.c MyStringMain: MyString.o MyStringMain.o gcc MyString.o MyStringMain.o -o MyString -o MyStringRun MyStringMain.o: MyStringMain.c MyString.c MyString.h gcc -c MyStringMain.c MyString.o: MyString.c MyString.h gcc -c MyString.c .PHONY:clean clean: rm -f *.o test.out [/CODE] For some …

Member Avatar for MarounMaroun
0
264
Member Avatar for xyz1987

Can anyone help me with searching for a particular address in a given range in C. like i have to search for *ptr in range specified by *high and *low. i think it is not same as linear search. can someone provide some input. thanks.

Member Avatar for gerard4143
0
73
Member Avatar for saad749

Hi, I am trying to make a Picture viewer for my BS Computer Science 1st Year Project in [B]Turbo C Compiler[/B]. I have to stick with this compiler atm. I want to be able to display BMP,PNGs and JPEGs [TIFF and others too if it won't be very difficult]. I …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for murtazamzk

Below is the program for swapping variables without any extra variable. [CODE] #include "stdio.h" #include "conio.h" void main() { int a=7;b=5; clrscr(); a=a+b; b=a-b; a=a-b; getch(); }[/CODE]

Member Avatar for Kamatari
0
175
Member Avatar for apbarratt

Hi guys, I would like to add a char to the end of a char* So imagine the following: char* test = "ABC" I want to add D to the end of it to get test == "ABCD" for the sake of argument, I can not use strcat as I …

Member Avatar for apbarratt
0
184

The End.