15,552 Topics
| |
When I run this code: [code=c] window_handle = CreateWindow("OpenGL", title, style, 0, 0, width, height, NULL, NULL, window_instance, NULL); if (!window_handle) { GL_KillWindow (); MessageBox (NULL, "Window creation error", "ERROR", MB_OK | MB_ICONEXCLAMATION); return false; } [/code] CreateWindow returns NULL. What are the reasons that could cause CreateWindow to fail? … | |
[CODE]do { ++temp_week; system("cls"); printf("\n"); printf("\t\t ***************************************\n"); printf("\t\t ***************************************\n"); printf("\t\t *** ***\n"); printf("\t\t *** WELCOME TO ***\n"); printf("\t\t *** CLASS ATTENDANCE SYSTEM ***\n"); printf("\t\t *** ***\n"); printf("\t\t ***************************************\n"); printf("\t\t ***************************************\n"); printf("\n\n"); printf("\t\t ******** MARKING OF ATTENDANCE ********\n"); printf("\t\t PRESENT = 1 ABSENT = 0\n\n"); for(i=0; fscanf(ReadFile,"%d|", &Student[i].studNo) != EOF; i++) … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
need help on single and multidimensional array... | |
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 … | |
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 … | |
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 … | |
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 | |
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, … | |
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 … | |
[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"; … | |
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 … | |
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 … | |
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 | |
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 /*****************************************************/ … | |
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 … | |
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> // … | |
I couldn't find a decent C network programming book for windows. Can anybody help me? | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
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 … |
The End.