1,494 Posted Topics
Re: You post 376 lines of code and don't tell us what the problem is? | |
Re: You really should be able to do this with one while loop and one for loop. The while loop reads the file and the for loop takes care of the number of entries. I tried playing with your code and came up with this, its hard coded to a four … | |
Re: Not really sure how this is a "brain teaser in C". | |
Re: Because with virtual memory every user process gets the same address range but different physical memory links...so every process appears to have the same memory but in reality it has its own copy of things like data...Note: most programs will shared some blocks of code i.e. Dlls and the text … | |
Re: It really depends on what and how you wrote your code...Could we see it so as to make an informed decision. | |
Re: I would investigate the functions strtok() and strtof(), strtod(), strtold(). | |
Re: I tried single quotes in your quoted string...it appears to work [CODE] #include <stdlib.h> #include <stdio.h> #include <string.h> int main () { char *ca; char queryStringSet[100]; char command[100]; strcpy (command, "export QUERY_STRING="); strcpy (queryStringSet, "'a=1&b=2&c=3'"); strcat (command, queryStringSet); printf ("command = %s\n", command); system (command); ca = getenv ("QUERY_STRING"); printf … | |
Re: Or you could use UDP instead of TCP. TCP doesn't guarantee packet data size only that it will get delivered in order...like you said if you want to extract individual messages then you'll have to figure out an application protocol to handle it.. | |
Re: I'm assuming this is a text file - Why don't you check for the newline character '\n' | |
Re: I'm not sure why you need to force the users to call init()- a well commented header file or docs should suffice or is this part of the assignment requirements.. | |
![]() | Re: shouldn't this [CODE] sscanf(buffer, "%lf", tempFinal [/CODE] be [CODE] sscanf(buffer, "%lf", &tempFinal [/CODE] ![]() |
Re: Try something like below: [CODE] .section .data v1: .byte 1, 2, 3, 4, 1, 2, 3, 4 v2: .byte 1, 5, 5, 5, 5, 5, 5, 5 .section .bss .section .text .global _start _start: movq v1, %mm0 movq v2, %mm1 pcmpeqb %mm0, %mm1 movq %mm1, %rdi movq $60, %rax syscall … | |
Re: [QUOTE=Shaikh Mohsin;1109987]Hello Friends, I have a small IP scan code written in shell script,i want my code should get executed as kernel get booted....plz tell how can i insert that code into new kernel...what are the steps should i follow..... [/QUOTE] The only thing that you can insert into a … | |
Re: [QUOTE] when i restart my PC to see weather my module is printing ' Hello World ' or not its not res poncing any thing [/QUOTE] That's because you ismod'd the module. You have to inform the kernel at boot up that you want the module inserted. Take a look … | |
Re: execve info/man has really good example code towards the bottom of the topic. Here's what I did: [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { char *newargv[] = { "/bin/ls", "-l", NULL }; char *newenviron[] = { NULL }; char *exeprog = "/bin/ls"; execve(exeprog, newargv, … | |
Re: Yes.. [url]http://www.daniweb.com/forums/thread252864.html[/url] | |
Re: 456 lines of code - That is the best you can do. You can't narrow the problem to a certain section of this program? | |
Re: This cleans up the warnings/errors [CODE] #include<stdio.h> int main(){ char name[25] = "blank", rating[25] = "blank", state[25] = "blank"; int lobbyists=0, prevemploys=0, number=0; double networth=0, tarp=0, contributions=0; printf("\n\n(1)Bank name: %s\n(2)State: %s\n(3)Net worth: %f\n", name, state, networth); printf("(4)Rating: %s\n(5)TARP money: %f\n(6)Campaign contributions: %f\n", rating, tarp, contributions); printf("(7)Lobbyists in capitol: %d\n(8)Previous Employees … | |
Re: [QUOTE=Soileau;1109461]Okay that makes some sense. How come I have to use a pointer to a pointer? Why can't I just use regular char? Also, I he said specifically that he wanted the state to be saved as "an 8-bit integer, 0 = Alabama,…49 Wyoming." But a regular int is only … | |
Re: [QUOTE=adcodingmaster;1109235]My question is Y DLL? i know that it saves memory and many process can use 1 DLL file at a time blah blah blah...... but is there any task which can not b achieved without using DLL files?? Please reply in details.[/QUOTE] I never understood the logic or lack … | |
Re: I never used SQLite3 but I'm going to say yes because when I googled SqLite3 it said this... [QUOTE] [B]Cross-platform C library[/B] that implements a self-contained, embeddable, zero-configuration SQL database engine. The site offers user and developer ... [/QUOTE] Why would you need C wrapper functions for a C library? | |
Re: If your into nasm then try this site [url]http://www.tortall.net/projects/yasm/[/url] | |
Re: Yes use fork then execlp(or one of the family of functions from exec). | |
Re: Are you kidding...narrow it down to an operating system plus area of programming.. | |
Re: This might be right, then again I may have read your posting wrong [CODE] #include <stdio.h> #include <stdlib.h> typedef char* (*firstptr)(void); typedef firstptr (*secondptr)(void); int main(int argc, char**argv) { secondptr myarray[10]; exit(EXIT_SUCCESS); } [/CODE] | |
Re: Try this, you had a typo in your array - 'a','b','c','e','d','e','f','g' - giving you excess elements plus a few more errors [CODE] #include <stdio.h> int main(int argc, char** argv) { char c[999]; char alpha[2][26]={{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'},{'a','b','c','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}}; int pos[26]; int i=0; for(i=0;i<26;i++) { printf("%c\n",alpha[0][i]); } return 0; } [/CODE] | |
Re: [QUOTE=johndoe444;1106351]Hi, Where does a static function reside? We know that static variables reside in BSS. So does a static function also reside in any particular place? Again is there any classification of functions like there is for data like heap, stack, BSS. Moreover, is function pointer similar to data pointer? … | |
| |
Re: I would open the file and read three lines into it and then display the results...This sounds like a for loop to me.. | |
Re: [QUOTE=fenerista;1096855] I can make my intterrup handler (IRQ) but if I change the original interrupt handler, the computer must be rebooted or I must made the interrupt handler, the original handler from my handler and I don't know whether that is can be done in kernel 2.6.x [/QUOTE] You didn't … | |
Re: Try investigating argv[0],,,example [CODE] #include <stdio.h> #include <stdlib.h> #include <string.h> #define FILE_EXT ".c" int main(int argc, char**argv) { char filename[256]; filename[0] = '\0'; fprintf(stdout, "argv[0]->%s\n", argv[0]); /*strcat(filename, &argv[0][2]);*//*for linux dot slash ./filename*/ strcat(filename, argv[0]); strcat(filename, FILE_EXT); fprintf(stdout, "filename->%s\n", filename); exit(EXIT_SUCCESS); } [/CODE] | |
Re: [QUOTE=sree_ec;1105659]As i did in my first post, i meant by using recursive function calls.... when we call a function recursively , it will automatically push the local variables to stack right? in my case , to print in reverse order, i thought recursion would be suffiecient[/QUOTE] You mentioned optimized in … | |
Re: Could we see some code...Your array, what type is it? | |
Re: [QUOTE=nshh;1105312]Hi, I m working in c and unix... Help me out how to become an expert in c programming.... suggest some website link, tutorials and books...for both c and unix.. Thanks, Nshh.[/QUOTE] The C programming Language by Kerninghan and Ritchie The Complete Reference C by Schildt | |
Re: Probably a typo: while((a=fscanf(plik, "%s", &quest))!= EOF) What's plik? | |
Re: [QUOTE=gedas;1104946]hi guy i started learning c recently, and im trying to do exercises from the book the bad thing is they are not showing the solutions. what i need to do is simply modify the program below so that instead of reading single characters at a time, it reads in … | |
Re: did you try displaying the value of int check, just to be sure its what you expect it to be? [CODE] void CRC(int check) { /*display check here*/ if (check != 0) { printf("NOT Corrupted"); } else { printf("Corrupted"); } // return 0; } [/CODE] Your not really give us … | |
Re: [QUOTE=bonzi200x;1104650]I'm implementing a TCP protocol. TCP implementation requires to send packets continuously and if the receiver doesnt respond after a particular interval of time it should resend the packet again. I need some method to implement a timer expiry function. How can I implement it?? Should i implement threads (If … | |
![]() | Re: Here's your answer [url]http://www.daniweb.com/forums/announcement118-2.html[/url] |
Re: [QUOTE=tzushky;1102980]Thanks for the reply, But I still have one question: how can you explain the fact that you can fill the array this way?: [CODE]struct my_struct my_array[] = { { TYPEA }, { TYPEB } };[/CODE] without nothing for the data field? And the one reason I needed pointers to … | |
Re: It may help if you gave us an example of what the resultant query/data set looked like and while your at it, could you show us the definition of test. | |
Re: Number - 2 the main function returns the address of main as its exit value.. | |
Re: Here's a very simple example: [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char**argv) { int i = 0; for (i = 0; i < 5; ++i) { if (fork()) { } else { fputs("Hello, World!\n", stdout); exit(EXIT_SUCCESS); } } exit(EXIT_SUCCESS); } [/CODE] | |
Re: [QUOTE=tien113;1095986][CODE]#include <stdio.h> int main(int argc, const char* argv[]) { int x; loopstart: printf("enter a value : "); scanf("%d", &x); getchar(); printf("value is %d\n", x); return 0; } [/CODE] can u help me, I want x return integer number (ASCII code) when enter a character... my code is not working... thanks...[/QUOTE] … | |
Re: Which port(s) are you trying to bind to? And can we see the code.. | |
Re: Not sure why this is located in the 'Window and Desktop' section..Check out the link below: [url]http://www.linuxforums.org/forum/linux-programming-scripting/149735-c-program-getting-sudo-password.html[/url] You'll find a solution that uses C and another that uses bash script. | |
Re: [QUOTE=surfer2009;1095980]i have just started c language and i have only study "while" and "for" "if else" please help me in this question using loops(without usuing arrays) write a program that prodeuce the following output: 0 0 1 0 1 2 0 1 2 3 0 1 2 3 4 0 … | |
What is going on here. Copy this C code , compile and run. What do you think is going on? Note I don't want the answer, I know what's going on here. This is just something for the rookies to play with... Also this is not the best way to … | |
Re: Try running this modified version of your program...What happened to the values from the stack? [CODE] #include <stdio.h> #include <stdlib.h> char ch[] = "Don't do this, passing back the value of a local variable is dangerous!"; int * first(); void myfunc(char *s, int x) { fprintf(stdout, "%s, %d\n", ch, x); … |
The End.