15,547 Topics

Member Avatar for
Member Avatar for themenucha

Hi! I'm making a chess program, that need to move pieces on the chess board, get an input,check if the move is valid and print the output. The compiler finds some errors that i don't understand...I need some help with the pieces functions. Plz help me fix them!!! my attempts …

Member Avatar for DJSAN10
0
531
Member Avatar for shaffatshah

I have a file(myfile.txt) with the following lines, the records are semicolon delimited [I]Bon Jovi;Living + 2;EP;A+ Metal Maze;Aliotta Haynes Music;LP;B- Shore Brothers, The;Wipe my door, check;LP;C+ Bulman, Dane & Greg;Dane & Greg Bulman;LP;C- Calbert, Herb & The Mexico Brass;Rise;LP;A´[/I] . . . I want to write a c program …

Member Avatar for WaltP
0
227
Member Avatar for Sundown G

Look my program read all lines from (plain.txt) and save temporary every read strings line by line into another text called(all.txt), i made the md5sum hash on each line separately of (all.txt) and saving this hashes on calculating.txt... then delete the all.txt and calculating.txt, creating a new copy of calculating …

Member Avatar for Sundown G
0
134
Member Avatar for Sundown G

Hi people I'm programming in C like a month. I just made this code yesterday, but I want the same result with a better code without using recursion for optimization, i think mine is sloppy. Also im using linux distribution... Any ideas to change this code in 1 or 2 …

Member Avatar for Sundown G
0
134
Member Avatar for shean1488

Hi everybody. Im trying to make a C program [CODE] 1 #include<stdio.h> 2 #define SIZE 100 3 4 int getline(char line[], int lim); 5 6 int getline(char line[], int lim) { 7 int c,i; 8 9 10 for(i=0; i<lim-1 && (c=getchar()) !="\0"; ++i) 11 line[i] = c; 12 if(c=="\n") { …

Member Avatar for savoie
0
242
Member Avatar for student2012

I need to prompt the user to enter two strings and then create a third string with the first half of string1 and the second half of string2. I was able to put the first half of string1 into string3 but I cannot figure out how to put the second …

Member Avatar for shanki himanshu
0
226
Member Avatar for shaker naser

Type an algorithm to solve the following problem: You want to read the different ages of a group of people until an age of negative is entered. Based on the ages entered, you should count and print how many of the people are old (above 65), how many are middle-aged …

Member Avatar for deceptikon
0
65
Member Avatar for arunsolo1984

How to print the enabled MACROS in my project? I am using C. RTOS eCos. Also i am using the makefile. In the makefile i wanted to print the all the defined MACROS.

Member Avatar for L7Sqr
0
48
Member Avatar for logicmonster

alright, well the code I have is a complete mess and there HAS to be a better way of doing it as well.... it's right here [CODE]#include <stdio.h> #include <stdlib.h> int toExit(int exit){ while(exit != 1 || exit !=2){ printf("\n\nPlease Choose:\n1) Exit\n2) Run program again\nYour choice: "); scanf("%d", &exit); printf("\n"); …

Member Avatar for logicmonster
0
293
Member Avatar for faezshingeri

Hi, What would be the best way to extract an array of strings (only the first strings separated by a "," ) encapsulated within the curly braces ( { } )from within a file...? Eg: Test.txt *************************** This is also in the text file { abc def ghi , jkl …

Member Avatar for faezshingeri
0
175
Member Avatar for jaymayne

Program wont run error says 1>c:\users\owner\documents\visual studio 2008\projects\ia\ia\jb bakery.c(16) : warning C4013: 'sleep' undefined; assuming extern returning int 1>Linking... 1>JB Bakery.obj : error LNK2019: unresolved external symbol _sleep referenced in function _welcome 1>C:\Users\Owner\Documents\Visual Studio 2008\Projects\IA\Debug\IA.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\Users\Owner\Documents\Visual Studio 2008\Projects\IA\IA\Debug\BuildLog.htm" …

Member Avatar for jaymayne
0
446
Member Avatar for onew1ng3d

If I had a structure like this [CODE]typedef struct { char word[101]; int freq; char filename[100]; } WordArray;[/CODE] and declared this inside a method instead of it being a global variable(so its local) [CODE] WordArray words[10000];[/CODE] then how would I allocate memory to this? I've had this [CODE] for (i=0;i<10000;i++) …

Member Avatar for histrungalot
0
75
Member Avatar for ItecKid

Hello all, I am trying to understand the concept of pipe-ing input/output through a C program. I wrote this simple code: [CODE] #include <stdio.h> #include <stdlib.h> void in_read (int *foo) { read (0, foo, 1); } void in_write (int foo) { write (1, &foo, 1); } int main (int argc, …

Member Avatar for histrungalot
0
183
Member Avatar for dark_sider_1

Hi there, I'm not sure if this is impossible to achieve or not, but I have a C program that I created that is compiled with an a.out executable. Is there a way that I could have it start/run automatically after I log in? I have a Mac running on …

Member Avatar for dark_sider_1
0
215
Member Avatar for passionated

(C language) Hi.. Can anyone write a function to accept a character and display it 10 times?? Thanks in advance..

Member Avatar for WaltP
0
587
Member Avatar for faithful4ever

Hello all, Basically I'm trying to code a program that makes use of recursion to reverse an input integer, e.g. 123 will result in a display of 321. I've coded the program this far, but it just displays the last digit only. Where have I gone wrong? I.e. Instead of …

Member Avatar for histrungalot
0
729
Member Avatar for TMDG

I am wondering how to read a file in c... this requires some more background information before you give me something useless What I have so far: [CODE]#include <stdio.h> int main(void) { FILE *fpr,*fpw; char C; int I; fpr = fopen("cwM.dat","r"); fpw = fopen("echocwM.dat","w"); while (C != EOF) { fscanf(fpr,"%c",&C); …

Member Avatar for WaltP
0
265
Member Avatar for badboy11

I need helping trying to retrieve data held in a [CODE]std::list<boost::shared_ptr<boost::any>>[/CODE] I am working on a Singleton Controller class with a private [B]std::list[/B]. Client class(es) will be able to [B]Add/Remove/Edit[/B] concrete class objects to be used by the program through this Controller class. The reason for using [B]boost::shared_ptr[/B] is because …

Member Avatar for mrnutty
0
383
Member Avatar for rithish

in multidimensional array what is the row and coloumn size.for example in 2d array a[2][2] this has 2 rows and 2coloumns .but what does this have a[2][3][4]????please explain me with practical example

Member Avatar for zeroliken
0
112
Member Avatar for anurag awasthi
Member Avatar for DeanMSands3
0
181
Member Avatar for swissknife007

Given an array A of length N, my task is to find the element which repeats in A maximum number of times as well as the corresponding count. In case of ties,I choose the smaller element first. Input First line of input contains an integer T, denoting the number of …

Member Avatar for VernonDozier
0
888
Member Avatar for infantheartlyje

Hi folks, I did a program to find a number at a lower bound position and upper bound position. For example, this is my array values 1 1 2 3 5 5 5 5 7 8 9 10 if i search lower position for 5 , it will return 4 …

Member Avatar for histrungalot
0
4K
Member Avatar for Sundown G

I post this thread in shell scripting too I want to search the user input in file (by lines) but not all then with this line search on another file ( with the specific line) and show to the user. Example: file1.txt ======= a aa aaa aab aac file2.txt (corresponding …

0
84
Member Avatar for tischn

Hi There i am developing a little Game Center (console application) for school. The Tic Tac Toe (singelplayer and Multiplayer) is already done. Now i want to develop a snake. When i test the snake, i get a force close. When i use a debugger, i have a SIGSEGV Error. …

Member Avatar for tischn
0
1K
Member Avatar for swissknife007

I am implementing a program where I want to store only certain part of the input string. for eg if the input string is 0123456789 I want to discard 4 AND 7 and store 01235689 Please my program requires an input string of 10000 characters so running time is very …

Member Avatar for mhd_arif123
0
201
Member Avatar for mike.bauer

How do I rewrite eq->pt_tree[0][0]=2; to user pointer subscript? [CODE]#include <stdio.h> #include <stdlib.h> /////////////////////////////// struct eq_values{ int * pt_tree[2]; }; //////////////////////////////// void main (){ struct eq_values input, *eq; int i =2; eq = &input; while(i--){ eq->pt_tree[i] = (int *) malloc(3 * sizeof (int)); if (!eq->pt_tree[i]){ printf("No\n"); exit(0); } } eq->pt_tree[0][0]=2; …

Member Avatar for deceptikon
0
107
Member Avatar for mike.bauer

I have the following struct deceleration and I would like to decrement eq->pt_tree[c][r], the row portion of pt_tree[c][r] using pointer subscript. How can I do this? [CODE]struct eq_values{ int * pt_tree[2]; }; eq->pt_tree[i] = (int *) malloc(12 * sizeof (int)); [/CODE] I think it will look like the following, but …

Member Avatar for deceptikon
0
142
Member Avatar for flagstone

I am trying to implement a chat program using epoll on the server side. However, the program gets stuck at epoll_wait(). How should I create an asynchronous chat program? [CODE] #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <sys/epoll.h> #include <fcntl.h> #include <netdb.h> #include <unistd.h> …

0
227
Member Avatar for Gaiety

Hi , what is the behaviour of below pseudo code. [CODE] pipe(fd) if(fork()){ read(fd[0]); } else { write(fd[1]); write(fd[1]); } [/CODE] I understand how system calls work , but could not understand the behaviour when used differently. secondly if a process uses while(1); in side its block, will the entire …

Member Avatar for Gaiety
0
186
Member Avatar for shanki himanshu

i am using 'atof' function to convert string into double but it shows the correct value if the string length is 17(max). is ther any function if string length is more than 17?

Member Avatar for DeanMSands3
0
147

The End.