15,554 Topics

Member Avatar for
Member Avatar for rwagnes

I am writing a short program in c on a linux platform which takes an argument from the command line. My only problem is retrieving that argument. It is an integer. Here's what is currently in my code: int seconds = *argv[0]; Thanks :cheesy: EDIT: Here is the rest of …

Member Avatar for rwagnes
0
166
Member Avatar for kirogthar

Firstly hello every1 this site helped me a lot with my ANSI C learning program... I am currently working on an homework about Binary sum, I explored the website and saw the binary - decimal conversion codes and they helped me a lot. But i seem like can't write the …

Member Avatar for Ancient Dragon
0
34
Member Avatar for RisTar
Member Avatar for Ancient Dragon
0
59
Member Avatar for mrjoli021

I have a function that returns an int. How can I call it from the main function.

Member Avatar for mrjoli021
0
85
Member Avatar for roby4eldiablo

Hi all, please help me. How to create makefile with target? my question is this: I have a file named "server.c" and must create a makefile for compile it in "cygwin" and in "solaris". the tag for the compilation in cygwin are: - Wall - DTRACE - g the tag …

Member Avatar for Ancient Dragon
0
76
Member Avatar for grunge man

um something i have been wondering for a long time is. how do u make it so the user inputs a word and the program identifies the word as a number so like if someone typed the word frog and it reconized it as the number 5.

Member Avatar for grunge man
0
122
Member Avatar for grunge man

um latly i have ben seeing stuff like bla_bla_bla in tutorials and stuff and im just trying to figure out what this "_" character is supost to mean could any one help me?

Member Avatar for grunge man
0
120
Member Avatar for iqbal

i am just start Computer grahics. that is my first program please help me [code=c] #include <GL/glut.h> void DrawPixels(); void OurPixelsDrawingFunction(); void SetView(); void SetView(int w, int h) { glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); } void DrawPixels() { glClearColor(1.0,1.0,1.0,0); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_PROJECTION); gluOrtho2D (0.0,600.0,0.0,600.0); OurPixelsDrawingFunction(); void OurPixelsDrawingFuntion() { glColor3f(0,1,0); /*Set …

Member Avatar for John A
0
115
Member Avatar for aPPmaSTer

Hey everyone! I've been trying for a couple of days now to make a function and it's driving me crazy. I need a function that takes a set of numbers in an array, for example: int array[]={4,3,5,7} and produce another array with all possible combinations of those numbers, or just …

Member Avatar for aPPmaSTer
0
106
Member Avatar for JadedTortoise

[B]Question:[/B]I ran into a point where it would be very helpful to send a function a portion of an array, instead of the entire thing. Now i can think of a couple work arounds like sending the whole array and a begin number, and range number, then computing off of …

Member Avatar for WaltP
0
182
Member Avatar for semmem1

I am trying to return an array of integers from a method into an array in my main. I know that you cannot pass an array in C, but you can pass a pointer to the array. My problem is though that every time I pass the pointer, I seem …

Member Avatar for semmem1
0
91
Member Avatar for alt234

I'm trying to write a recursive merge sort on a linked list. I'm basically stuck on the split portion of it currently. I came up with a solution quite similar to many other solutions I've found on the web. Many people say it works but so far my solution doesn't …

Member Avatar for thinkfast
0
119
Member Avatar for roby4eldiablo

[CODE]servaddr.sin_port = htons(ADD_PORT); Bind (listenfd, (SA*) &servaddr, sizeof(servaddr)); Listen (listenfd, LISTENQ); #ifdef TRACE err_msg ("(%s) info - socket created, port number= %ld, child number= %ld, waiting for connections ...\n", prog, ADD_PORT, child_n); #endif /* viene detto a signal come reagire se arriva il segnale SIGCHLD, cioè avvia sigchld_h*/ signal (SIGCHLD, …

Member Avatar for thekashyap
0
67
Member Avatar for IwalkAlone

Q.Write a function to accept a main string, one search string and one replace string. Replace the first occurence of search string in main string by replace string{assume the length of search and replace string is same). Solution I tried [CODE] #include<stdio.h> #include<conio.h> void main() { char mai[80],search[40],replace[40]; int i,j,k,l; …

Member Avatar for John A
0
124
Member Avatar for Colin Mac

I used what's below to delete a directory. It only deletes the directory if it's empty. How could I delete a directory and it's contents? [code] #include <unistd.h> int main() { rmdir("C:\\haha"); return 0; } [/code]

Member Avatar for Colin Mac
0
95
Member Avatar for Nholdamek

I've been building this program to interface with the Swis ephemeris library. It's working beautifully, except for one thing. OK, I need to be able to specify it to retrieve information about multiple planets, such as longitude, speed, etc. So I have a function that parses the command line parameter …

Member Avatar for Nholdamek
0
282
Member Avatar for gamodg

[code=cplusplus] #include<stdio.h> #include<conio.h> #include<fstream.h> void file() { for(int i=0;i<30;i++) { char a[10]="2-2aa.pak"; a[4]=a[4]+i%26; a[3]=a[3]+((i/26)%26); fstream file; file.open(a,ios::in |ios::out); file<<"anshulgarg"; file.close(); } } void main() { file(); } [/code] it creates 30 files with new names in bin but when i give relative path ex "\\p\\2-2aa.pak" and adjust a[8],a[9] appropriately it …

Member Avatar for Salem
0
81
Member Avatar for jivosan

Sorry for the nubbish question , but I'm wondering which function will do the trick-read a char from keyboard without need to press "Enter"???

Member Avatar for Salem
0
164
Member Avatar for gamodg

[color=#3333FF]presenting here a program fragement of my project two files mainn.txt mp.txt format i have given at the end of this code the problem is that while printing mp.txt the output is not in format as i expected [/color] [code] [color=#33CC00]DF: 1 SA: 2-2 DA: R1 D: 3 SA: R1 …

Member Avatar for GreenDay2001
0
73
Member Avatar for mrjoli021

i have a string array and I need to change it to uppercase. what function can I use??

Member Avatar for mrjoli021
0
73
Member Avatar for potato_bum

for example.. number.txt: (has these contents) 1.75:2.00:3.00 2.00:5.00:7.24 3.00:6.35:1.00 -- my source code is.. [code=c] #include <stdio.h> int main() { FILE *infile; double a, b, c; char d; double sum; infile = fopen("number.txt", "r"); if(infile == NULL) { printf("number DOES NOT EXISTS!"); } else { while(!foef(infile)) /*here's my problem*/ { …

Member Avatar for Aia
0
5K
Member Avatar for potato_bum

for example.. number.txt: (has these contents) 1.75:2.00:3.00 2.00:5.00:7.24 3.00:6.35:1.00 -- my source code is.. #include <stdio.h> int main() { FILE *infile; double a, b, c; char d; double sum; infile = fopen("number.txt", "r"); if(infile == NULL) { printf("number DOES NOT EXISTS!"); } else { while(!foef(infile)) /*here's my problem*/ { fscanf(infile, …

Member Avatar for thekashyap
0
1K
Member Avatar for shrikant telkar
Member Avatar for thekashyap
0
57
Member Avatar for roby4eldiablo

Hi all, someone can tell me where i can find an example of this kind of signal handler? i try to use fenv.h but on cygwin doesn't work (cygwin don't have it) and this program must run on cygwin and on solaris. i try also with SIGFPE, but when i …

Member Avatar for roby4eldiablo
0
94
Member Avatar for notfornothing21

What does the identifier [COLOR=navy]"[B]break[/B]"[/COLOR] mean and how would it be used? Thanks.

Member Avatar for John A
0
125
Member Avatar for endsamsara

Hi, I'd like to know how the following program work. [CODE] #include "stdio.h" #include "stdlib.h" #include "conio.h" #include "graphics.h" #include "dos.h" void iniciar_grafica(); void graficar_datos(); void graficar_vectores(); int procesos[4][5]={1,8,2,4,6, 2,3,8,9,6, 0,1,2,3,4, 0,0,0,0,0},procesos_ejecutados[5]; int cpu=5,uso_cpu,mayor,prioridad,i,midx,midy,pid=4,j; char num[10],c; int main(void) { clrscr(); iniciar_grafica(); midx=getmaxx()/2; midy=getmaxy()/2; while(1){ for(j=0;j<5;j++){ graficar_vectores(); graficar_datos(); cleardevice(); } printf("Si …

0
72
Member Avatar for ideas-adv

Develop a[COLOR=red] C program[/COLOR] that has a structure for a list of students that has the array of students and the number of students. The structure for each[COLOR=red] student[/COLOR] consists of [COLOR=blue]ID number, name, GPA, number of courses, and a list of courses[/COLOR]. The structure for each [COLOR=red]course[/COLOR] consists of …

Member Avatar for ideas-adv
0
99
Member Avatar for IwalkAlone

Q.Write a function to accept 20 characters and display whether each character input is a digit, lower case letter or upper case letter. Solution I tried [code=c] #include<stdio.h> #include<conio.h> int main() { char inp; int i; clrscr(); for(i=0;i<20;i++) { printf("Enter a character\n"); scanf("%c",&inp); if(inp>='0'&& inp<='9') { printf("It is a digit\n"); …

Member Avatar for FoX_
0
71
Member Avatar for jigoro

is there a way to convert everything i input to my program into its ascii binary equivalent? if so please show me; thanks.

Member Avatar for FoX_
0
81
Member Avatar for disc

I'm trying to retrieve the name of the computer that my programm is running on. This is the code: [code] TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1]; DWORD cnt = MAX_COMPUTERNAME_LENGTH + 1; std::string name = [COLOR=#800000]""[/COLOR]; [COLOR=#0000ff] if[/COLOR]( GetComputerName( compName, &cnt) ) { name = compName; } [COLOR=#0000ff] return[/COLOR] name; [/code] The …

Member Avatar for disc
0
103

The End.