15,550 Topics

Member Avatar for
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
98
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
94
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 mvmalderen
0
95
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 mvmalderen
0
157
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
248
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
72
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
42
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
478
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
343
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
101
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
170
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
64
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
112
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
131
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
73
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
147
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
129
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
120
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
73
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
84
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
75
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
187
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
288
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
81
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
186
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
61
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
532
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
80
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

The End.