15,552 Topics

Member Avatar for
Member Avatar for _hp_

Does anyone knows how to assigned directly the sqlite query result to a struct in C rather that assigning to its members one by one? I have a table user_info with fields user_id, username, password. Also I have a struct st_user_info. typedef struct st_user_info{ int userId; char* userName; char* password; …

Member Avatar for Ancient Dragon
0
244
Member Avatar for shotgun2011

Hi everyone! This is the code that I have written in order to print a tic-tac-toe board. For example, if input was this: 1 2 0 1 1 2 0 2 0 The board would be this: X . O X X . O . O However, I don't know …

Member Avatar for Dani
0
147
Member Avatar for sujinsr

#include "stdio.h" int main() { //FILE *fp; char get[20] ; char password[15]; int choice; choice: printf("\nSELETCT: 1.Login 2.Password change 0.Exit \n"); scanf("%d", &choice); if(choice == 1) { FILE *fp; fp = fopen("PASS.txt","r"); fgets(password,15,fp); printf("your current password is %s\n", password); printf("Enter password: "); scanf("%s",get); if( !strcmp(get, password) ) { printf("\n%s\n", "Logged …

Member Avatar for Nimrod7676
0
265
Member Avatar for Daigan

#include <stdio.h> int main() { char opt; do { printf ("Enter y or n: "); opt = getchar(); } while (opt != 'y' || opt != 'n'); } okay so my code does not stop when I enter y or n, which I think it should.

Member Avatar for Nimrod7676
0
107
Member Avatar for hwoarang69

this works fine but i was wondering if there a way to recreate my insert function without returning any thing. for ex right now in my insert function iam return a function. but i want to recreate it so that its void insert(char *li) here is my code #include <stdio.h> …

Member Avatar for DeanMSands3
0
122
Member Avatar for hwoarang69

trying to create a insert method thats takes a char *name and int age. after than iam trying to insert in linked list. its seem to be working fine but if i have a linked lets say [1 2 3 4 5] and if i try to insert(2). i shoudl …

Member Avatar for zeroliken
0
177
Member Avatar for xEffrego

I get a compile error on the line while (iteration < MAX_ITERATION && sqXY <=4) { The error is: expected ')' before ';' token I am pretty sure it used to work before, this problem just popped up randomly just then. Can't the while thing take 2 expressions or can't …

Member Avatar for xEffrego
0
2K
Member Avatar for Valiantangel

I am getting an error fors x in the polynomial expression.If i put my cursor it says Expected:a';' Code blocks are created by indenting at least 4 spaces ... and can span multiple lines #include<stdio.h> #include<stdlib.h> int main(void) { double x=2.55; double polynomial=3x^3-5x^2+6; printf("The value of polynomial is %lf\n",polynomial); system("pause"); …

Member Avatar for zeroliken
0
77
Member Avatar for themenucha

Hi! I'm trying to emplement the job queue. Somehow i can't initialize it: the queue is empty `Inline Code Example Here` //INCLUDES #include <stdio.h> #include <stdlib.h> #include <semaphore.h> #include <pthread.h> //GLOBALS pthread_mutex_t job_queue_mutex = PTHREAD_MUTEX_INITIALIZER; int i; #define N_threads 10 int val=0; //STRUCTURES typedef struct job { int data; struct …

Member Avatar for histrungalot
0
419
Member Avatar for ChaseRLewis

long FileSize(FILE* f) { if(f) { long size; long initpos = ftell(f); fseek(f,0,SEEK_END); size = ftell(f); //Get End Position Which fseek(f,initpos,SEEK_SET); //Go Back To Initial Position return size; } return 0; } Only 183 characters in text file but reports 197. Reason for this?

Member Avatar for ChaseRLewis
0
106
Member Avatar for djokerfan20

Hi everyone! This is the code that I have made, however, when I enter a date for example if I type : 12/12/2012 then the date for tomorrow displays a list of dates. I am unsure how to get it to only display the date of tomorrow. #include <stdio.h> int …

Member Avatar for djokerfan20
0
245
Member Avatar for svcj92
Member Avatar for alaa sam

hi everyone I'm asked to implement malloc and free as my project in operating system course , but the big problem is that i have searched a lot about it and still have no idea about it , if anyone can tell me what are the main functionalities of the …

Member Avatar for alaa sam
0
286
Member Avatar for Valiantangel

hi in C if someone says printf(%d,x); is x int and double or just int? I know %d is decimal . Will this be the same for printf(%d,&x);? Also cin>>x.Can x be any arithematic type? Thanks

Member Avatar for Ancient Dragon
0
110
Member Avatar for zaken5000

Hi everyone, I want to excess a operate according to a wide range dimension or perhaps tips. Ex: int calc(int a[]); int calc(int a[][]); as well as int calc(int *a); int calc(int **a); *a ought to be &a however i don't realize how to encounter any research of an reference …

Member Avatar for TrustyTony
0
86
Member Avatar for swissknife007

I am designing my own algorithm to check if 2 codes are similar or identical? How do pre-exsting softwares do this? What logic do they use? Are there different levels of testing for this? please give detailed answers **CLOSED DUE TO DOUBLE POST, SEE** http://www.daniweb.com/software-development/cpp/threads/420816/how-to-check-2-codes-are-similar-or-identical

Member Avatar for L7Sqr
0
239
Member Avatar for willjohanz

.Write a C program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex,exam Scores (3 quizzes per semester), mid-term score, final score, and total score. after entering them write them to a file called Student.txt

Member Avatar for Ancient Dragon
-1
89
Member Avatar for Jake Black

Hello I have wrote a c program to solve sudokus, and i would like to know if i can draw the grid and fill it using ncurses library. i just would like to know how to control the lines and borders of boxes in ncurses thank you very much

0
161
Member Avatar for JQadrad

Hey all, I am working on a project with an FPGA but I need serial communication between the FPGA and the desktop since the memory of the FPGA is limited and I need to be able to send longer inputs to the FPGA by using buffers on the desktop. After …

0
169
Member Avatar for hwoarang69

iam trying to use only one function to get the value of add and sub. if there is a label i want to ignore it. file.txt ------------------------ label: add $1,$2,$2 sub $1,$2,$2 ----------------------- int main() { char line2[20]; char tem_line2[20]; char *tptr; while(fget...line2) //read one line and store in char …

Member Avatar for histrungalot
0
229
Member Avatar for nee_88

why is the output of the below program is coming out as 'unequal' ??can anyone please explain?? #include<stdio.h> void func(char *); void main() { char *q; char *p; p="hello hii"; func(q); if(p==q) printf("equal"); else printf("unequal"); } void func(char *pi) { pi="hello hii"; }

Member Avatar for rubberman
0
102
Member Avatar for jwill222

I meant to post this in the C forum and not the C++ forum. Below is the link to a picture of the debug error window [url]http://www.flickr.com/photos/7629837...in/photostream[/url] It's a program that i'm doing and I keep getting this error here's a link to the programming problem. Its' Number 3 [url]http://books.google.com/books?id=bSy...%2B%2B&f=false[/url] …

Member Avatar for jwill222
0
268
Member Avatar for nee_88

Please refer to the code below.It is used to extract files from a given directory, for further processing. #include <dirent.h> #include <stdio.h> #include <string.h> int main(void) { int i=0; struct dirent *direntry; dir = opendir("E:/muzikk"); if(!dir) { printf("Error: directory did not open!\n"); return 1; } while((direntry=readdir(dir))!=NULL) { printf("%d %s\n",i,direntry->d_name); i++; …

Member Avatar for nee_88
0
247
Member Avatar for willjohanz

Write an ATM machine programme that will prompt a user to enter a password "DEF" and username "ABC" after which it should ask the user what they want to do and depending on what they choose ,perform necessary actions from depositing to check balance...in your programme include writing and reading …

Member Avatar for TrustyTony
0
61
Member Avatar for abhishekagrawal

Dear All, I have written a program which converts an input decimal number into any number in a base between 2 and 36. Below is my program: #include<stdio.h> #include<stdlib.h> int main() { int newbase,n,i,ascii,ndigit=0,q,r,zero; char newrep[100]; printf("Enter the number to be converted"); scanf("%d",&n); printf("Enter the base between 2 and 36 …

Member Avatar for Ancient Dragon
0
145
Member Avatar for tubby123

Please refer the code below I am trying to read integers from a file (till the end of file). But my problem is that only the last number is printed twice. /* fscanf example */ #include <stdio.h> int main () { int i; FILE * fp; fp = fopen ("/home/my/Desktop/write.txt","r"); …

Member Avatar for Ancient Dragon
0
98
Member Avatar for CKShia

Hi i am a newbie in C programming especially in the socket area. Supposely i am writing a FTP, and want to **_get_** and **_put_** file in the FTP. However, i have encountered a bug/error when client is trying to get(download) file from server. The problem is as follow: First, …

Member Avatar for histrungalot
0
992
Member Avatar for AnnA.A

Hi, I'm new here, so I'm sory if this theme already exsist. I'm trying to do a database of students in c, and I want to use queue for realizing that. For example: Name: char surname: char id number: char or int subjects: queue User will enter id number and …

Member Avatar for AnnA.A
0
204
Member Avatar for abhishek_ag

Hi Guys, I have written the below program to convert binary to octal, it is giving me erroneous results. On entering 1111 as the input number I should get 17 as the output, whereas I am getting 16707000337 as the output. Kindly help me out, below is my program: /*program …

Member Avatar for abhishek_ag
0
265
Member Avatar for ogrishmania

I want to delete the first element from a list. this is my list: struct dlist { int liber; //it translates as "free" don't know what this is int nmax; //maximum number of elements DATA *pv; //a pointer with which i can move in list, also DATA is int }; …

Member Avatar for Ancient Dragon
0
134

The End.