15,551 Topics
| |
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 … | |
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; } … | |
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, … | |
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 … | |
Please can anybody tell me the difference in return 0 and system ("pause"); | |
| 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 … |
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 … | |
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. | |
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 … | |
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, … | |
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 … | |
[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) … | |
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 … | |
| |
I want to use to dimensional arrays to draw a graph. How do i go about it. I have never use it before. Please | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 () … | |
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 … | |
| 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 … |
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 … | |
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 … | |
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 | |
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 … | |
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 | |
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), … | |
[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) … | |
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!! |
The End.