15,551 Topics

Member Avatar for
Member Avatar for MentallyIll5150

Hi all, I'm writing this piece of code out in unix. What I want to do is pass an integer argument through the command line and then manipulate it from there. I've done char strings before but cannot seem to get it to work with int's. Once I have this …

Member Avatar for MentallyIll5150
0
88
Member Avatar for EvilOrange

i'm trying to parse a string of digits that can be 1 to 3 chars long, but how to do this is eluding me. would an isDigit method work? like this: [CODE="c"] if(isdigit(vararray[v])){ if(isdigit(vararray[v+1]) || vararray[v+1]==NULL){ if(isdigit(vararray[v+2]) || vararray[v+2]==NULL){ if(isdigit(vararray[v+3]) || vararray[v+3]==NULL){ return; } return; } return; } return; } …

Member Avatar for Salem
0
101
Member Avatar for pymatio

I have this code: [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]){ char *s = getenv ("HOME"); FILE *f; int optchar; char line[300]; char p[100]; strcpy(p, s); strcat(p, "/todo.txt"); while ((optchar = getopt(argc, argv, "r:a:ldc")) != -1){ switch (optchar){ case 'a': f = fopen(p, "a"); fprintf(f, …

Member Avatar for Salem
0
96
Member Avatar for chalumaal

Hi Friends, I am facing a probelm. The moment I complete a program i C (version 3), it complies successfully. However, the moment I try to run the program it says a Linker error. I have tried to sort this out through Option-Linker, but in vain. I really need you …

Member Avatar for tux4life
0
99
Member Avatar for osei-akoto
Member Avatar for Tom Gunn
0
4K
Member Avatar for Lioshenka

Hiya, I've got a lickle program here which reads data about people into structures and then saves their surnames in a Binary Search Tree. There is more stuff to go to that program, that is why I need structures, but at the moment [B]I can not understand why it doesn't …

Member Avatar for tux4life
0
161
Member Avatar for no1zson

I have to hit <Enter> twice after inputting my dollar amount and store selection I think I am just missing something simple somewhere, but am going stupid looking for it. Went to the internet to try and find a good debugger, but have no idea how or where to even …

Member Avatar for no1zson
0
250
Member Avatar for osei-akoto

Please can somebody help me to concatenate names in c. I try to enter names but anytime it will teat them as separate strings. this is what I tried to do : But i was getting segmentation faults, can you figure anyway out.

Member Avatar for Salem
0
76
Member Avatar for rickhard_22

Hi, I'm trying a few things in C, but cannot advance now. This program should read what it written in the shared memory if does not take any arguments. However if arguments are passed it should write what is passed into the memory. I can make it work if just …

0
43
Member Avatar for jasonjinct

let say I got input.txt with following thing [QUOTE] Kelly // name of student 67 // Biology Score 89 // Chemistry score Michelle 75 45 John 78 90 [/QUOTE] and I use this fscanf command to scanf all the file until EOF: while ((fscanf (input, "%s %d %d", &studName, &bioScore, …

Member Avatar for Tom Gunn
0
484
Member Avatar for rakesh_01

Hi guys, I'm working in C in PuttY server.I'm looking for a program that can display an interactive menu that interacts with the user and also display a clock in the top right corner of the screen. So I need a program that can draw a border using C, and …

Member Avatar for Ancient Dragon
0
362
Member Avatar for want_to_code

[code] #include<stdio.h> #include<stdlib.h> #include<conio.h> struct node { int info; struct node* llink; struct node* rlink; }; typedef struct node* NODE; NODE insert(NODE root,int data) { NODE temp,cur,prev; temp=(NODE)malloc(sizeof(struct node)); if(temp==NULL) printf("\nOut of memory"); temp->info=data; temp->rlink=temp->llink=NULL; if(root == NULL) { printf("\n1st time\n"); root=temp; return root; } prev=NULL; cur=root; while(cur != NULL) …

Member Avatar for want_to_code
0
103
Member Avatar for no1zson

Realized something today by accident. I am asking for a dollar amount in my program, and checking to make sure it is a valid amount above $0. What I am not checking for is a character response. I have tried some stuff, and nothing seems to work. Can anyone look …

Member Avatar for no1zson
0
174
Member Avatar for osei-akoto

Please can somebody tell me when and how to use the time .h library

Member Avatar for Tom Gunn
-1
66
Member Avatar for osei-akoto

I want to use to dimensional arrays to draw a graph. How do i go about it. I have never use it before. Please

Member Avatar for yellowSnow
0
116
Member Avatar for DaBunBun

So I was looking over someone elses code, and the main is unusual, no type. its just: #include <math.h> main(int argc, char *argv[]) I've come up with 2 theories: 1) It defaults to int? 2) #if/#endif directives somehow negate the need for int? Have no experience with this though, so …

Member Avatar for Salem
0
135
Member Avatar for cooldev

Hi , IM TRYING TO WRITE A TEXT FORMAT PROGRAM along the lines of the algorithm & pascal code found in similar named problem in "how to solve it by computer" R.G.Dromey. What it does is take a "limit" from user and users input text...it outputs the re-formatted text as …

Member Avatar for yellowSnow
0
75
Member Avatar for xyzt

Hello, I was just trying to write some simple codes to learn C. I wrote 3 functions, create a list,print a list and free a list. but i get segfault while printing the list. (by the way, list is not a list datastructure. it's just an array) In create_list, I …

Member Avatar for Tom Gunn
0
149
Member Avatar for DaBunBun

So 2 questions. 1) MPI_Init. I'm trying a python -> c -> cluster project. So I have no problem with the python -> c, but the problem comes with the c-> cluster. I'm making a python wrapper (I believe this is the correct term) around a premade c driver for …

Member Avatar for DaBunBun
0
132
Member Avatar for jasonjinct

Hello, I google and search through about the 2 dimension array and I still not really understand how to do it.. for example: I got a file input called namelist.txt with following thing John Jason Leonard Kelly Kate Ash and I got the following code: #include <stdio.h> int main () …

Member Avatar for vali82
1
123
Member Avatar for duggydiggy

Greetings All, I was wondering about how a build process goes on in Vc++. I want to know that is there any intermediate assembly file generated while building a source file as what happens with gcc. If the answer is no ,then why gcc build process has this ones step …

Member Avatar for Hiroshe
0
75
Member Avatar for onaclov2000

Ok, so this is confusing me alot, right now I have a structure as such: [CODE]struct f_c_8 { union { float f; unsigned char c[8]; }; };[/CODE] now I declare a variable of that type [CODE]f_c_8 Time;[/CODE] However, The following prints correct number [CODE] fprintf (output_file_pointer,"\t\tTime: %f\n",event_data->Time); [/CODE] And the …

Member Avatar for Dave Sinkula
0
85
Member Avatar for melissa.johns

I am making a program that has a bunch of embedded if statements. I need random number that are between 0 and 1. In order to get really "random" numbers, I set up the program to get the seed from the cpu time. Then, to get the number between 0 …

Member Avatar for melissa.johns
0
79
Member Avatar for DeathEvil

I have an array of floats: float net_pay[5] . Each element is a decimal number ie. 999.99, 35.42, 318.34 etc . What I would like to do is to scan the decimal portion, in first case it would be 99 to a variable cents. I know how to do it …

Member Avatar for 42Wired
0
190
Member Avatar for yasaswyg

i need help I need to display Example 23.4 and display 23 and .4 how do i do this? so i need to convert a decimal into fraction like this [url]http://www.cimt.plymouth.ac.uk/projects/mepres/book7/bk7i17/bk7_17i1.htm[/url] i need to display 4 and 0.276

Member Avatar for 42Wired
0
294
Member Avatar for urbancalli

I am trying to make a dialog box that can open, edit and save .txt files. I referred my codes in this [URL="http://www.winprog.org/tutorial/dialogs.html"]tutorial[/URL]. How am I going to modify the code so that instead of a "save as" function, it will directly "save" the file that it opened/edited. Thanks in …

Member Avatar for Protuberance
0
83
Member Avatar for Crushyerbones

Does anyone here have any tips on using inb and outb for interacting with hardware on a Linux system? iopl(2) and inb(0x61) don't seem to work very nicely... Infact, inb(0x61) gives me a segfault. PS: My reliance on this forum is starting to become embarrassing :P

Member Avatar for Crushyerbones
0
190
Member Avatar for silviubogan

This is a just simplified case because my C file is too big to post it here: [CODE=C] int main(int argc, char **argv) { GtkWidget *window, *vbox, *toolbar, *locationentry; GtkToolItem *locationbar; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); vbox = gtk_vbox_new(FALSE, 0); toolbar = gtk_toolbar_new(); locationentry = gtk_entry_new(); locationbar = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(locationbar), …

0
63
Member Avatar for kaio-ken

[code=c] #include<stdio.h> #include<conio.h> typedef struct { int rno; char name[10]; float marks; }stu; stu stu3; void getf(stu * stutmp); void show(stu * stutmp); void main() { clrscr(); getf(&stu3); show(&stu3); getch(); } void getf(stu *stutmp) { scanf(" %d",&stutmp->rno); printf("%d\n",stutmp->rno); scanf(" %s",stutmp->name); printf("%s\n",stutmp->name); scanf(" %f",&stutmp->marks); printf("%f\n",stutmp->marks); getch(); } void show(stu * stutmp) …

Member Avatar for kaio-ken
0
535
Member Avatar for duggydiggy

Greetings, Is there any way may be some tools to view and explore contents of .obj files (in a formatted or unformatted way) or an executable. Can we do it using gcc? Please guide. Cheers!!

Member Avatar for Salem
0
83
Member Avatar for taikoprogrammer

Hi everyone, So I am writing this program that is supposed to do the following: Create a program that accepts a string from the user (not from the command line) and displays: 1. The string using upper-case letters, e.g. all lower-case letters are converted to upper-case letters 2. The string …

Member Avatar for yellowSnow
0
4K
Member Avatar for katwalatapan

Hello, Could anyone assist me in starting out with pointers. I know that pointers direct to the memory location where a value is stored, but I am having some issues with understanding the concept with arrays. Could you suggest a simple startup code, where a pointer points to a memory …

Member Avatar for Tom Gunn
0
118
Member Avatar for shaju_nitk

Hi, Need help to write the below mentioned program. Create an employee struct with following fields EMP_NAME EMP_ID DOJ (Date of joining) Read in the values from a file and store them in the above structure. Print the employee details if an EMP_ID is given. Regards, Shaju

Member Avatar for yellowSnow
0
237
Member Avatar for nandakv4

hello, i am trying to store some values in an array dynamically. doing this as i dont want to over allocate memory to my array. so the code goes as follows:: [code] #include<stdio.h> #include<stdlib.h> int *p; main() { int i; for(i=1;i<6;i++) { p= (int *)malloc(sizeof(int)); *p++ = i*i; } printf("\n …

Member Avatar for nandakv4
0
96
Member Avatar for forestwwq

I write a small program like following: 1, firstly create a process waiting for keyboard input commands(via getchar()). 2, secondly create a thread in the process waiting on a message queue. each time after the thread receive a message, it can handle the message but cannot print the log message(via …

Member Avatar for frk
0
340
Member Avatar for Salem

This is a catalogue of some experiments on just two aspects of undefined behaviour. This was inspired by yet another long bout of explanation in a recent thread, so I thought it was time to dust off a bunch of compilers, and compare. This is the test code. [code] #include …

Member Avatar for frk
4
585
Member Avatar for muusa

this is the code #include<stdio.h> void main() { int i; printf("%d, %d",++i,i++); } and following is the output 8429558, 8429556

Member Avatar for muusa
0
119
Member Avatar for RobBrown

Hello, i can not quite figure out how to write a function to take numbers from an array and sort so it displays even numbers first and then odd numbers. the output should look like this: [QUOTE]Original: 9 8 7 6 5 4 3 2 1 Reversed: 1 2 3 …

Member Avatar for Tom Gunn
0
140
Member Avatar for user98

I'm a .net programmer so forgive me if this is a stupid question, but here goes. I'm working with a vendor to interface our system with theirs. We are sending text data via modem. The protocol specifications they have given us require a checksum value to be appended to the …

Member Avatar for Salem
0
294
Member Avatar for duggydiggy

After going through lots of stuff about declaration and definition,in a nutshell I understand that the difference is in the memory allocation. In definition yes and in declaration no memory is allocated. Fine ,Is there any process that shows that yes [code] int a; //which is a definition [/code] allocates …

Member Avatar for Salem
0
200
Member Avatar for taikoprogrammer

Hi Everyone, I am having some trouble with the code I am writing. I am supposed to find the sum all ASCII codes in the string, omitting the newline character at the end of the user input. Here are the directions I am given: Create a program that accepts a …

Member Avatar for wildgoose
0
916
Member Avatar for Alibeg

Hi guys....i have a problem and I hope you can explain me where am I wrong... I am doing some kind of Breadth First Search (BFS) ("some kind of" because this is my first program to use this algorithm) I have an array of size 4^9 (262144 for those of …

Member Avatar for Alibeg
0
182
Member Avatar for Lioshenka

Hi, I already asked but haven't had an answer. What I am trying to do is to write a program which will read the data from the file into BST with the ability to search by surname (surname is the key). After sleepless nights I have managed to do something, …

Member Avatar for Tom Gunn
0
70
Member Avatar for alvalany

When i was runnning the graphucs c program in turbo c the program was terminated. I gives an error message as 16-bit MS DOS subsystem The NTVDM CPU has encountered an illegal instruction. CS:d000 IP:03e2 OP:ff ff eb 05 ea Please provide me the solution I also tried using dosbox.. …

Member Avatar for alvalany
0
205
Member Avatar for duggydiggy

Hi, This is a basic question that's why i am confused. When I do printf("%d",sizeof(long double)) in Linux(i am using a vmware) Ans:12 bytes in msvc 2008 Ans:8 bytes My underlying arch for both implementation is intel IA32. What is the reason if the arch is same.If the fundamental data …

Member Avatar for Salem
0
89
Member Avatar for wizkids157

Hi, I've just started using Netbeans 6.5.1, and I was wondering if you can run a single C file independently of the other C files in the project. This works for java. For example, you can run test1.java and test2.java independently in the same Java project. But it doesn't seem …

0
57
Member Avatar for mevanga

Can someone help me to write a code in C Programming that will ask the user to enter a PIN and if the PIN is entered 3 times wrongly the program should exit. Thanx in advance.......

Member Avatar for mevanga
0
125
Member Avatar for no1zson

I am new to C programming and have been using the GOTO all over the place until today when I was informed it is not preferred practice, and due to its adverse affects on debugging and maintenance should only be used in the rarest of cases. I can understand that …

Member Avatar for hket89
0
150
Member Avatar for hket89

/* File: Kilowatt-hours.c Calculate and print bills for the city company.*/ #include <stdio.h> int main() { int account_number; char code; double bills, kilowatt_hours, peak_hours, off_peak_hours; printf("Please enter Your account number: \n"); scanf("%d", &account_number); printf("Enter Your user code [R/C/I]: \n"); printf("R = Residential\n"); printf("C = Commercial\n"); printf("I = Industrial\n"); printf("\nCode = …

Member Avatar for DangerDev
0
301
Member Avatar for revenge2

hey guys how would i figure out if a string has a number in it without using any aditional libraries?

Member Avatar for Hiroshe
0
5K

The End.