15,551 Topics

Member Avatar for
Member Avatar for Chef Boyardee

Hello, this is my first post here. I'm playing around with Gtk+ and Xlib. I'm trying to get the X window ID of the active window, and then display that ID in a Gtk label. However, when I run it, it seg faults. I've narrowed it down to `XGetInputFocus`, but …

Member Avatar for Chef Boyardee
0
638
Member Avatar for COKEDUDE

Whats the best way to removes values from array of strings? Is it better to create a new array of strings or is there some way to remove them?

Member Avatar for AssertNull
0
403
Member Avatar for COKEDUDE

Why does order matter with this if else if statement? if((row1 = mysql_fetch_row(result1)) && adding_to_member_flag != 1) { printf("Do not update date since it already exists\n"); } else if(!(row1 = mysql_fetch_row(result1)) && adding_to_member_flag != 1) { printf("Update end_date and add new team\n"); } When I had it like this the …

Member Avatar for AssertNull
0
417
Member Avatar for COKEDUDE

My second while condition is being ignored and I don't understand why. I would think I have 1 and 0 = 0 so it would break out. while(fgets(line, sizeof line, stdin) && sscanf_counter != 2) { }

Member Avatar for rubberman
0
263
Member Avatar for COKEDUDE

I am trying to print my data in columns. For some reason every column but the last one lines up. Is there a way to fix this? while ((row = mysql_fetch_row(result))) { //printf("198\n"); for(int i = 0; i < num_fields; i++) { //printf("----------\n"); printf("%25s ",row[i]); if(row[i] == NULL) { printf("No …

Member Avatar for cereal
0
250
Member Avatar for COKEDUDE

What does this printf do? Not familiar with the question mark, colon, and extra NULL at the end. printf("%s ", row[i] ? row[i] : "NULL");

Member Avatar for hericles
0
174
Member Avatar for 小名

I can't slove this problem my code print nothing what's wrong with it ?? #include <stdio.h> #include <string.h> #include <ctype.h> #define total 1000 int weight (char word[total]) { int i; int sum; for (i=0;word[i]!='\0';i++) { sum+=i; } return sum; } char *getword (char temp[total]) { static char max[total]={'\0'}; int lenth,maxlenth; …

Member Avatar for 小名
0
1K
Member Avatar for COKEDUDE
Member Avatar for rproffitt
0
1K
Member Avatar for ajit.nayak

I am using Mplab x Ide with v3.61 on Xc8 compiler, PIC18F24K40. I used MCC generated UART code for send and receive data. For understanding I am clubling my code and posting part of it. My main code look like this #include "mcc_generated_files/mcc.h" #define EUSART_TX_BUFFER_SIZE 8 #define EUSART_RX_BUFFER_SIZE 8 /** …

Member Avatar for itnavigate
0
3K
Member Avatar for victoria_5

i made a property tax program but now i have to use it with pointers. i have to use 3 functions inputtotalsales,calculatetaxes,and displaytaxes.It was easy for me to do this the regular way but im having an issue with pointers . im getting errors saying redeclaration of statetax and countytax …

Member Avatar for tinstaafl
0
360
Member Avatar for subha_2
Member Avatar for Sooraj_2
Member Avatar for JamesCherrill
0
159
Member Avatar for Mooyeon

My program find the amount of specific word such as "whale" and "thee", but ignore "thee,", "whale....", and so on. How can I contain them? #include<stdio.h> #include<string.h> #include<ctype.h> int main(){ FILE *md,*out; char CHA[255]; char cha[255]; cha[255]=tolower(CHA[255]); char thee[]="thee"; char chapter[]="chapter"; char whale[]="whale"; char meet[]="meet"; int th=0; int ch=0; int …

Member Avatar for ruediger.bayer
0
384
Member Avatar for COKEDUDE

How would I split this big if statement across multiple lines? It works perfectly on one line. if (mysql_query(con, "CREATE TABLE Matches(match_id INT UNSIGNED PRIMARY KEY, date DATETIME NOT NULL, tournament INT UNSIGNED, playerA INT UNSIGNED, playerB INT UNSIGNED, scoreA INT UNSIGNED, scoreB INT UNSIGNED, offline bool)")) { finish_with_error(con); } …

Member Avatar for AndrisP
0
265
Member Avatar for COKEDUDE

This is what I came up with for reading a csv file with multiple types. It seems to get the job done in all cases but 1,2,,"a". Where there is a blank space. Can I please have some ideas on how to fix this? const char* getfield(char* line, int num) …

Member Avatar for COKEDUDE
0
329
Member Avatar for COKEDUDE

I keep getting this message. undefined reference to `mysql_get_client_info' From what I can figure out when I google it I am not linking correctly. So I tried this. gcc *.c -L"C:\Program Files\MySQL\MySQL Server 5.7\lib" Can I please get some help on what I am doing wrong?

Member Avatar for rproffitt
0
171
Member Avatar for Mooyeon

I wrote the code that using txt file, but error "0 [main] assignment4 16012 cygwin_exception::open_stackdumpfile: Dumping stack trace to assignment4.exe.stackdump" is only thing that printed to console. Here is my code. #include <stdio.h> int main() { FILE *fp; char buff[255]; fp = fopen("moby_dick.txt", "r"); printf("%c\n", fgetc(fp)); fscanf(fp, "%s", buff); printf("1 …

Member Avatar for rproffitt
0
226
Member Avatar for Lennac

So, I'm relatively new to programming and I'm working on a program that allows for input of grades, course hours, and then calculates GPA based on that. But, I'm going step by step, the first thing I'm trying to do is ensure that I can input the data so that …

Member Avatar for Lennac
0
340
Member Avatar for COKEDUDE

Are there any good tutorials c programming with mysql? I only found one promising link, unfortunately they neglect to to show what is in their header files which doesn't help very much. http://zetcode.com/db/mysqlc/

Member Avatar for rproffitt
0
403
Member Avatar for Vikrant_3

typedef struct{ int*p; }new; void main(){ new *buffptr=malloc(sizeof(new)); buffptr->p; } my doubt is the above declaration in main function accesses the value of p and not the address of p. If I want to increment the address of p what should I do?

Member Avatar for rubberman
0
145
Member Avatar for MUHAMMAD AHMAD_1

Write a C++ program that takes in text from the user and prints the total Number of spaces used in the text. Kindly, use #include<iostream> and #include<conio.h> only. while loop is more preferable than for or do-while.

Member Avatar for Reverend Jim
0
347
Member Avatar for Mooyeon

I made first board, but when I use function next_generation, it prints wrong result. For example, since first board is 01000 00100 11100 00000 00000, next one should be 00000 10100 01100 01000 00000 . But my program prints 00000 00100 01100 00000 00000. Here is my code. #include <stdio.h> …

Member Avatar for JamesCherrill
0
362
Member Avatar for Steve_37

gerard4143 explained 6 years ago how to store binary code in memory and then execute it. See https://www.daniweb.com/programming/software-development/threads/353077/store-binary-code-in-memory-then-execute-it#post1500738. In the example, we create an array of unsigned char containing these values: 0x50,0x57,0x56,0x52,0xe8, 0x00,0x00,0x00,0x00,0x5e, 0x48,0x81,0xc6,0x24,0x00, 0x00,0x00,0x48,0xc7,0xc0, 0x01,0x00,0x00,0x00,0x48, 0xc7,0xc7,0x01,0x00,0x00, 0x00,0x48,0xc7,0xc2,0x0e, 0x00,0x00,0x00,0x0f,0x05, 0x5a,0x5e,0x5f,0x5a,0xc3, 0x48,0x65,0x6c,0x6c,0x6f, 0x2c,0x20,0x57,0x6f,0x72, 0x6c,0x64,0x21,0x0a,0x00 This works fine when I use the …

Member Avatar for rproffitt
0
349
Member Avatar for victoria_5

I am making a bank program with functions.1 called displaymenu that produces a menu d(make deposit),w(make withdraw),b(check balance) and q(quit).2nd function is getdeposit which accepts balance as parameter and asks user for amount they want to deposit then add amount to balance and return it to main function.3rd getwithdrawal same …

Member Avatar for Reverend Jim
0
597
Member Avatar for Robert_66

Hi, I'm trying to make a program that sets up the hight dpi compatibility mode programatically on Windows 10, so that I don't have to set up manually the properties of every legacy *.exe program I use, there are hundreds. When you set up that on a local drive, Windows …

Member Avatar for rproffitt
0
1K
Member Avatar for Chris_45

So i'm in the process of learning about functions and I'm not grasping the full operation of them. I have a menu in which I have utilized a function but I want to create a fucntion for each of the menu options. I've heard of pointers but I haven't researched …

Member Avatar for Joris Claassen
0
374
Member Avatar for GURPREET_6

class space { public static void main(String args[]) { int i; for(i=0;i<5;i++) { System.out.print("*"); System.out.print("_"); } } for(i=0;i<5;i++) { System.out.println("*"); } }

Member Avatar for Joris Claassen
0
401
Member Avatar for Kerri_1

Hello i'm working on this piece of code and I have the idea how it should be. But I believe my assignment is base on boath C and shall formating command to create a menu. The code is working so far fine but in order to move on furthur. I …

Member Avatar for Joris Claassen
0
1K
Member Avatar for AndryGabry1
Member Avatar for Rahul47

Writing a function strreplace(s,chr,repl_chr) to replace the character 'chr' with character 'repl_chr' in a givne string s. I have done so far with following code. Getting awkward output. // Program to replace occurence of a character with another character in a string. #include<stdio.h> #include<conio.h> void strreplace(char *,char,char); int main() { …

Member Avatar for Reverend Jim
0
21K

The End.