1,494 Posted Topics

Member Avatar for damndamn

[QUOTE=damndamn;1136544]please help.. can u give me the codes... :([/QUOTE] Could you give money?

Member Avatar for peter_budo
-3
185
Member Avatar for johndoe444

[CODE] void dfs(graph g) { printf("whats wrong with me\n"); for (int i = 0;i < g.number_vertices;i++) { g.vertices[i].color = WHITE; g.vertices[i].p = NIL; } time = 0; printf("in dfs\n"); for (int i = 0;i < g.number_vertices;i++) { if (g.vertices[i].color == WHITE) { // dfs_visit(g, i); printf("i: %d\n",i); } } } …

Member Avatar for johndoe444
0
137
Member Avatar for Takarakujin

I modified your code somewhat to display the intial/final values of c1/c2....What do you notice? [CODE] #include <stdio.h> int main() { char c1 = 0, c2 = 0; fprintf(stdout, "our initial values c1->%d, c2->%d\n", c1, c2); printf("Enter a character: "); scanf("%c", &c1); printf("Enter another character: "); scanf("%c", &c2); fprintf(stdout, "\nour …

Member Avatar for gerard4143
0
135
Member Avatar for kendaop

Here's some code to demonstrate what happens when you cast an unsigned long to unsigned char... [CODE] #include <stdio.h> #include <stdlib.h> unsigned long myint = 1234567890; int main(int argc, char**argv) { int i = 0; unsigned char *cptr = (unsigned char*)&myint;/*cast myint to unsigned char*/ for (i = 0; i …

Member Avatar for Dave Sinkula
0
5K
Member Avatar for goldenmean
Member Avatar for Dave Sinkula
0
287
Member Avatar for abhimanipal

Because the compiler padded the structure elements up to whole bytes. one byte for signed int a:3; two bytes for unsigned int b:13; and on byte for unsigned int c:1; Try using the attribute packed like below and you'll get three bytes because again the compiler will pad the end …

Member Avatar for abhimanipal
1
94
Member Avatar for VernonDozier

Yup...have some suggestions... 1. use read and write instead of fread and fwrite

Member Avatar for VernonDozier
0
141
Member Avatar for COKEDUDE

When you want to left or right shift some bits...or splice some addresses together like below..So when would you need this skill? Hardware programming comes to mind.. [CODE] #include <stdio.h> #include <stdlib.h> unsigned long two = 3345; int main(int argc, char**argv) { unsigned long one = 1234; void *addr = …

Member Avatar for gerard4143
0
111
Member Avatar for jamesl22

You know it took Linus Torvalds years to make the very first 'very simple' Linux kernel. If your interested in this area ckeck out Minix.

Member Avatar for manutm
0
145
Member Avatar for rico.tee

Please check the result of this action: [CODE] fptr1=fopen("input.txt", "r"); [/CODE]

Member Avatar for abhimanipal
0
154
Member Avatar for sahiti
Re: C

Right from my linux/GNU man file [QUOTE] BUGS Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store charac‐ ters past the end of the buffer, it is extremely dangerous to use. …

Member Avatar for Dave Sinkula
-5
138
Member Avatar for klactose
Member Avatar for gerard4143
0
174
Member Avatar for COKEDUDE

You realy should google C functions and C control statements....You'll find the answers in these queries...

Member Avatar for WaltP
0
255
Member Avatar for blerina12

Shouldn't this end with a NULL execve(argv[0], argv, envp, NULL); Ooops my mistake.

Member Avatar for blerina12
0
1K
Member Avatar for jazz_vill

[QUOTE=jazz_vill;1130436]what i meant is the data files is on another hardrive... my partition table is: /dev/sda3 -this is my C: drive /dev/sda4 - this is my / partition /dev/sda5 - my D: drive /dev/sda6 - my swap partition my data is in in sda5. Thanks for the reply mate![/QUOTE] your …

Member Avatar for here2serve
0
121
Member Avatar for Kevin_160
Member Avatar for WaltP
0
94
Member Avatar for lamoracke

Well if I had to do this, I would investigate binary trees or get the book "The C Programming Language" which has an example of this code...

Member Avatar for holocron
0
94
Member Avatar for hsp700

You should get a table of ascii characters and look up the character equivalent for 10.

Member Avatar for hsp700
0
132
Member Avatar for abhimanipal

Try this: [CODE] int main(int argc, char* argv[]) { printf("%lf\n",(0.99F - 0.90F - 0.09F)); } [/CODE]

Member Avatar for abhimanipal
0
99
Member Avatar for tzushky

I know this is knit picking... [QUOTE] We all know that we can use the name of an array as the pointer to that array, [/QUOTE] The name of an array is a label which is a convenient human readable memory address. Its not a pointer...

Member Avatar for Narue
0
3K
Member Avatar for COKEDUDE
Member Avatar for anjoz

As a quick response, I would suggest initializing these local variables to zero. int n,teens,thousands,hundreds,tens,ones,tthousands;

Member Avatar for abhimanipal
0
76
Member Avatar for Nicholas_Roge
Member Avatar for gerard4143
0
97
Member Avatar for flipjoebanana

[QUOTE=flipjoebanana;1126320]Is there a way to hide assembly code when my C code references a library function that deals with memory? (Not showing 'asm' code)?[/QUOTE] Maybe if you gave us an example of what your trying to accomplish...Because I'm having a hard time understanding what you mean...

Member Avatar for gerard4143
0
133
Member Avatar for abhi.navale

Well I guess your not completely switch. I would reinstall Vista and run Ubuntu via Virtual Box since you have the install disks for Ubuntu. [QUOTE] But for some reason I want vista in virtaul machine. [/QUOTE] Sounds like your unsure of your reasoning here...

Member Avatar for gerard4143
0
135
Member Avatar for veledrom

Try this link, it provide some simple examples [url]http://www.metatitan.com/linux/5/how-to-tar-untar-from-the-command-line.html[/url]

Member Avatar for gerard4143
0
131
Member Avatar for gangsta1903

About [CODE] gets(name); [/CODE] This is what manpages has to says about gets() [QUOTE] BUGS [B]Never use gets()[/B]. Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and because gets() will continue to store characters past the end of the buffer, …

Member Avatar for gerard4143
0
71
Member Avatar for Kombat

[QUOTE=Kombat;1122143]Isn't fgets only used from reading in from a file? Also [code]fgets(a, sizeof(a, stdin) ); [/code] gives error too few arguments Also I realized maybe I should have in arrays instead of char arrays because I am working with bits (1's and 0's) so fgets shouldn't work[/QUOTE] Too few for …

Member Avatar for Kombat
0
152
Member Avatar for badlucky
Member Avatar for PMACLEAN
Member Avatar for abhimanipal
0
182
Member Avatar for icu222much
Member Avatar for icu222much
0
1K
Member Avatar for rajdesire

Volatile tells the compiler that a variable may be changed in ways not explicitly specified by the program - According to C: The complete Reference. This means the volatile variable may be changed by forces outside of the current process(usually the kernel, hardware or another process) so don't make any …

Member Avatar for gerard4143
0
144
Member Avatar for asm2hex

Not sure if this is what your looking for.. [CODE] #include <stdio.h> #include <stdlib.h> #include <string.h> struct mystr { char ch1[50]; char ch2[50]; }; void myfunc(struct mystr *str1, struct mystr *str2) { memcpy(&str2->ch1[0], &str1->ch1[0], sizeof(str1->ch1)); memcpy(&str2->ch2[0], &str1->ch2[0], sizeof(str1->ch2)); } int main(int argc, char**argv) { struct mystr str1 = {"string one", …

Member Avatar for JuhaW
0
118
Member Avatar for Kru

Check this posting for a pipe example: [url]http://www.daniweb.com/forums/thread258136.html[/url]

Member Avatar for Kru
0
143
Member Avatar for ankur_

[QUOTE] g++ -Wno-trigraphs -Wno-unused -Wno-deprecated -Wpointer-arith [/QUOTE] Why are you posting C++ in the C forum?

Member Avatar for gerard4143
0
365
Member Avatar for kymarscheng

The only thing that comes to mind is a using USB key to protect your program settings...What are you writing that requires that kind of security?

Member Avatar for kymarscheng
0
166
Member Avatar for solitude_spark

I tried this and it worked: file1.h [CODE] #define USD 1 [/CODE] file2.h [CODE] #define UKP 1 [/CODE] file3.c [CODE] #include<stdio.h> #include "file1.h" /*#include "file2.h"*/ #ifdef USD #define curr 46 #endif /*#ifdef UKP #define curr 100 #endif*/ int main() { int rs; rs = 10 * curr; printf ( "ans->%d\n", …

Member Avatar for Nick Evan
0
86
Member Avatar for robbtek

Try piping the the response back into the program like: [CODE] #include <stdio.h> #include <stdlib.h> #include <unistd.h> enum PIPES {READ, WRITE}; int main(int argc, char**argv) { int i = 0; char ans[256]; char ch; int hpipe[2]; pipe(hpipe); if (fork()) { close(hpipe[WRITE]); dup2(hpipe[READ], 0); close(hpipe[READ]); while ((ch = fgetc(stdin)) != EOF) …

Member Avatar for Salem
0
373
Member Avatar for cmsc

[QUOTE] please help me find the error in this code. whenever i try to get the successor, the program gets the status access violation error. i think it's the parameter. [/QUOTE] You think its the parameter...How are passing it to the function and what are some of the values your …

Member Avatar for cmsc
0
197
Member Avatar for ibuguser

[QUOTE=ibuguser;1121089]Hi, I have a program that writes to a specific memory location. I can currently read the value doing this: [CODE] #define address1 0x000F0000 //this is the memory location unsigned long *val1 = (void *) address1; [/CODE] So * val1 contains what I need from the other program. Now I …

Member Avatar for gerard4143
0
147
Member Avatar for mattitude

char slide[20] and int slide(FILE *ifp, char delimeter[], char wild); are both defined to mean two different things...I'm guessing that slide[20] is hiding the function slide.

Member Avatar for mattitude
0
377
Member Avatar for mhera
Member Avatar for pao+kriz

[QUOTE=pao+kriz;1120689]how about this kind of pyramid? * * * * * * * ** * * * * * * * * * * * * * * * *[/QUOTE] Yeah. How about it?

Member Avatar for gerard4143
0
57
Member Avatar for miles.85

Do you mean reading a file that's composed of the character s '0' and '1'...because when you read/write a file the data is binary...

Member Avatar for miles.85
0
143
Member Avatar for dondajr

Try this link [url]http://msdn.microsoft.com/en-us/library/h21280bw%28VS.80%29.aspx[/url] In your example try using the octal notation.

Member Avatar for dondajr
0
287
Member Avatar for xavier666

I think this is what you want: - Note your code generates a [B]memory leak[/B] on line 43... [CODE] # include <stdio.h> # include <stdlib.h> struct test { int data; struct test *link; }; void change(struct test **ptr); int main() { struct test *fresh = (struct test *)malloc(sizeof(struct test)); int …

Member Avatar for xavier666
0
144
Member Avatar for jmstickney
Member Avatar for Dave Sinkula
0
86
Member Avatar for abhimanipal
Member Avatar for Kombat

I've seen this extension to the language to handle binary constants...you might be able to incorporate it. Notice the number 0b111 [CODE] #include <stdio.h> #include <stdlib.h> int main(int argc, char**argv) { fprintf(stdout, "ans->%u\n", 0b111); exit(EXIT_SUCCESS); } [/CODE]

Member Avatar for Salem
0
117
Member Avatar for zangetsuu

The End.