1,494 Posted Topics

Member Avatar for D_switch
Member Avatar for WaltP
0
4K
Member Avatar for me_roy

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 …

Member Avatar for me_roy
0
316
Member Avatar for Conqueror07
Member Avatar for ithelp

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 …

Member Avatar for Conqueror07
0
83
Member Avatar for InnocentVamp

It really depends on what and how you wrote your code...Could we see it so as to make an informed decision.

Member Avatar for Narue
0
172
Member Avatar for infrapt
Member Avatar for gerard4143
0
55
Member Avatar for VernonDozier

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 …

Member Avatar for VernonDozier
0
847
Member Avatar for johndoe444

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..

Member Avatar for gerard4143
0
112
Member Avatar for c0d3x

I'm assuming this is a text file - Why don't you check for the newline character '\n'

Member Avatar for mitrmkar
0
2K
Member Avatar for markfisher

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..

Member Avatar for markfisher
0
161
Member Avatar for Iamthedude

shouldn't this [CODE] sscanf(buffer, "%lf", tempFinal [/CODE] be [CODE] sscanf(buffer, "%lf", &tempFinal [/CODE]

Member Avatar for Iamthedude
0
121
Member Avatar for nunos

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 …

Member Avatar for nunos
0
108
Member Avatar for Shaikh Mohsin

[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 …

Member Avatar for gerard4143
0
215
Member Avatar for Shaikh Mohsin

[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 …

Member Avatar for gerard4143
0
184
Member Avatar for Gonbe

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, …

Member Avatar for gerard4143
0
273
Member Avatar for nathanurag
Member Avatar for Draculaboy1014

456 lines of code - That is the best you can do. You can't narrow the problem to a certain section of this program?

Member Avatar for gerard4143
-2
140
Member Avatar for Soileau

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 …

Member Avatar for WaltP
0
182
Member Avatar for Soileau

[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 …

Member Avatar for gerard4143
0
137
Member Avatar for adcodingmaster

[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 …

Member Avatar for Ancient Dragon
-2
108
Member Avatar for eliza2044

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?

Member Avatar for eliza2044
0
111
Member Avatar for kshetri
Re: Nasm

If your into nasm then try this site [url]http://www.tortall.net/projects/yasm/[/url]

Member Avatar for gerard4143
0
77
Member Avatar for paddy8788
Member Avatar for nezachem
0
241
Member Avatar for prachi bhujbal

Are you kidding...narrow it down to an operating system plus area of programming..

Member Avatar for tux4life
-6
69
Member Avatar for johndoe444

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]

Member Avatar for Dave Sinkula
0
319
Member Avatar for rgpii

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]

Member Avatar for gerard4143
0
2K
Member Avatar for johndoe444

[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? …

Member Avatar for gerard4143
0
1K
Member Avatar for gedas
Member Avatar for BoB3R

I would open the file and read three lines into it and then display the results...This sounds like a for loop to me..

Member Avatar for Dave Sinkula
0
128
Member Avatar for fenerista

[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 …

Member Avatar for fenerista
0
259
Member Avatar for leeba

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]

Member Avatar for leeba
0
675
Member Avatar for sree_ec

[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 …

Member Avatar for Ancient Dragon
0
143
Member Avatar for phil750
Member Avatar for nshh

[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

Member Avatar for Dave Sinkula
0
101
Member Avatar for iamminsk
Member Avatar for iamminsk
0
283
Member Avatar for gedas

[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 …

Member Avatar for mitrmkar
0
129
Member Avatar for javaStud

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 …

Member Avatar for thomas_naveen
0
76
Member Avatar for bonzi200x

[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 …

Member Avatar for bonzi200x
0
70
Member Avatar for zzjason
Member Avatar for mas20k

Here's your answer [url]http://www.daniweb.com/forums/announcement118-2.html[/url]

Member Avatar for gerard4143
-10
55
Member Avatar for tzushky

[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 …

Member Avatar for Narue
0
185
Member Avatar for ContactaCall

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.

Member Avatar for Dave Sinkula
0
418
Member Avatar for johndoe444

Number - 2 the main function returns the address of main as its exit value..

Member Avatar for gerard4143
0
95
Member Avatar for phil750

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]

Member Avatar for gerard4143
0
81
Member Avatar for tien113

[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] …

Member Avatar for WaltP
0
139
Member Avatar for Simzz
Member Avatar for gerard4143
0
438
Member Avatar for VernonDozier

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.

Member Avatar for jolies2
0
184
Member Avatar for surfer2009

[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 …

Member Avatar for gerard4143
0
107
Member Avatar for gerard4143

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 …

Member Avatar for jonsca
1
114
Member Avatar for Iam3R

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); …

Member Avatar for Tajon Wong
0
361

The End.