1,088 Posted Topics

Member Avatar for vibe0405

>Everything works fine but for the address I need more than 1 word, separated by space, so I tried using the getchar() function. Yes, this is a classic. scanf() is very lousy for obtaining string input from user. It can handle spaces but not by default, and it is prompted …

Member Avatar for cthoes
0
2K
Member Avatar for cthoes

BTW Drop the & in scanf(), it is either [ICODE]scanf("%s", name)[/ICODE] or [ICODE]scanf("%s", &name[0])[/ICODE], but not scanf("%s", [COLOR="Red"]&[/COLOR]name)

Member Avatar for cthoes
0
101
Member Avatar for cwarn23

[QUOTE=cwarn23;1082187] Does anybody know how to define a mixed variable?[/QUOTE] There's not such a thing as mixed variable. Variable overloading does not exist in the C language.

Member Avatar for cwarn23
0
134
Member Avatar for akim_atl

>I am all confused, I don't where to start. Declare a variable that will keep money amount. Ask the user for money amount. Read the input. Process the input in a function to determined how many bills of each class needs to be outputted.

Member Avatar for virgo_norz
0
1K
Member Avatar for milanese

[QUOTE=milanese;1079035]Hi, [code]@echo off SET Day=%date:~0,2% SET Month=%date:~3,2% SET Year=%date:~6,4% SET cdate=%Year%%Month%%Day% SET localDir=D:\New_Files SET newDir=D:\test COPY "D:\New_Files\*.dat" "D:\test\*.dat" pause rem dir c:\windows[/code] [/QUOTE] The way you are setting the variables of day, month and year are incorrect. [CODE] ECHO %date% Wed 12/16/2009 [/CODE] Therefore 16 would be the day which …

Member Avatar for Aia
0
111
Member Avatar for javaStud

[QUOTE=javaStud;1077531]yes I have understood. Now that I have removed the while statement, I am still encountering the same problem (printing only 0s). Could it be that as an output I am getting only the first byte of the frame, or am I displaying the array incorrectly? Thanks a lot. [/QUOTE] …

Member Avatar for javaStud
0
92
Member Avatar for raghuhr84

[QUOTE=xavier666;1069864]Points to be noted, raghuhr84 [list] [*]Give the complete program, that is, give [icode]#include<stdio.h>[/icode]. Becomes easier for us to check. [*]Use proper indentation [*]Use code tags around your program (See the forum rules) [/list] The problem is that you have not flushed stdin. Put [icode]fflush(stdin);[/icode] before the [icode]scanf[/icode]. That should …

Member Avatar for Dave Sinkula
1
690
Member Avatar for Vita1ity
Member Avatar for Aia
0
42
Member Avatar for Almutamarred

That's not help. That would be doing your homework for you. Read the forum rules. You need to show effort, and what better way than posting the code that you have tried so far?

Member Avatar for Almutamarred
-4
147
Member Avatar for Micia

You missed to read the rules of the forum. We don't give any code away without you posting what you have done to show effort.

Member Avatar for xavier666
0
193
Member Avatar for Mattpd

[QUOTE=Mattpd;1053048] This script below gives me the proper result, but I had to cheat to do it. I just substituted "OUT:06/12/2007:MATT" for "IN" and appended it to the file.txt and then deleted the entire old line. Only problem is that the line is now at the end of the file …

Member Avatar for hichnam
0
156
Member Avatar for hookah

[QUOTE=hookah;1063281]i can nt belive no one can help me in this. No one knows c in here[/QUOTE] We don't do homework. Read the forum rules. And what you believe or do not believe is irrelevant.

Member Avatar for hookah
0
255
Member Avatar for isxrc

isxrc> PLS PLS PLS can someone help. I have 24 hours from now and the clock is ticking. The urgency is on your part, not on ours. You have chosen to fail already. Read the rules of the forum. We do not give away code solutions without proof of effort …

Member Avatar for Aia
0
116
Member Avatar for natureG

Some points for now: [CODE]newPtr = malloc(sizeof(job)); /*create new node*/[/CODE] What's job? I don't see job anywhere. [CODE=c] if ((jPtr = fopen("jobticket.txt", "w"))== NULL) { printf("File could not be opened\n"); } fclose (jPtr);[/CODE] Doesn't make any sense regardless the file gets opened or not you close it right away. You …

Member Avatar for meghana8818
0
882
Member Avatar for Iam3R

[QUOTE=Narue;1060207][B]>but still compiled and ran without incident.. [/B] Yet another ding against gcc for not conforming to the standard, I suppose. Those switches put the compiler in strict conformance mode, which means a constraint violation like this would be rejected outright.[/QUOTE] [B]-ansi[/B] switch, all that it does is to support …

Member Avatar for Aia
0
93
Member Avatar for sknake

[QUOTE=crunchie;1042598]C'mon ppl. Give me at least [i]one[/i] vote :D[/QUOTE] You are worthy of more than one. There!

Member Avatar for cwarn23
1
313
Member Avatar for characteredu

[QUOTE=richman0829;1054570]For me, it's Quest For Fire. I really got involved with the characters (even learned their language!), and in the final scene, I just had to be grateful I had ancestors like them, or I wouldn't be here typing this.[/QUOTE] Quest For Fire, definitely, an entertaining movie. However, you realize …

Member Avatar for pritaeas
0
183
Member Avatar for guest7

[CODE]sed -e [COLOR="Red"]"[/COLOR]s/[COLOR="Red"]$[/COLOR]old_string/[COLOR="Red"]$[/COLOR]new_string/[COLOR="Red"]"[/COLOR] file1.txt > file2.txt[/CODE]

Member Avatar for chrislee.980
0
95
Member Avatar for naziatarannum

[QUOTE=naziatarannum;1056903]Hi all, I have a simple question as it appears. But am unable to get the solution. Question is -how do I get the access time of a file in unix. please advise on the command. Thanks[/QUOTE] [ICODE]stat[/ICODE] might give you what you want.

Member Avatar for Aia
0
109
Member Avatar for Gaurav arora

[quote=qaisu;339997]Well C is too old for 2007[/quote] I disagree. Let's say you want to develope harware drivers; what program lenguage dominates there?. Let's say you want to develope operating system kernels; what program do you think is used? Anything that has to do with "closer to the metal" C is …

Member Avatar for ashutosh1234
0
99
Member Avatar for dewdropz

[CODE]scanf("%[COLOR="Red"]f[/COLOR]", &length);[/CODE] length is an int, you are passing a float. Same with [ICODE]scanf("%f", &breadth);[/ICODE] Either you change the type in the declaration of length and breadth, or change the[ICODE] f [/ICODE]to[ICODE] d [/ICODE]in the calling of scanf().

Member Avatar for Ancient Dragon
0
209
Member Avatar for Mattpd

[QUOTE=Mattpd;1042106]I am trying to delete any line of text that contains "$npname" and the word "in." The script works if $npname is only one word, but if it is more than one work I get "error: unterminated address regex" How can I fix this? [CODE]sed '/'$npname'.*in/d' parts.txt > parts.tmp[/CODE][/QUOTE] It …

Member Avatar for Mattpd
0
4K
Member Avatar for jk2005.jeeva

[QUOTE=jk2005.jeeva;1048400] [COLOR="Green"]int[/COLOR] main([COLOR="Green"]void[/COLOR]) { int x=20,y=35; [COLOR="Red"] x=y++ + x++; y= ++y + ++x; [/COLOR] printf(“%d%d[COLOR="Red"]\[/COLOR]n”,x,y); /* is should be \n */ [COLOR="Green"]return 0;[/COLOR] } [/QUOTE] Those two expressions invoke undefined behavior. Anything can be the result. It is best if you write [COLOR="Red"]int[/COLOR] main(), and [COLOR="Red"]return[/COLOR] inside of main …

Member Avatar for kommuru
0
380
Member Avatar for naziatarannum

[QUOTE=naziatarannum;1048468]Hi, Please help in this regard. Can the modification time of a file be updated to any date of our choice? Please advise. Thanks in advance![/QUOTE] Look into the command [ICODE]touch[/ICODE]

Member Avatar for naziatarannum
0
113
Member Avatar for Soileau

[QUOTE=Soileau;1049212][CODE]#include <stdio.h> struct poly { int len; int arr[3]; /* this must have a defined size, three for example */ char *name; }; int main() { int i; struct poly p; p.len = 45; /* p.arr[3] = {1,1,1}; p.arr[3] is only one integer, you can not load three into it …

Member Avatar for Mathura
1
169
Member Avatar for userits

Click [URL="http://www.daniweb.com/forums/post1048411.html#post1048411"]here[/URL] and [URL="http://www.daniweb.com/forums/post1049104.html#post1049104"]here[/URL].

Member Avatar for Aia
2
141
Member Avatar for timaquerra

[QUOTE=timaquerra;1048427]is it possible to put void function into loop statement?[/QUOTE] Yes, why do you ask? There must be something else you want to know.

Member Avatar for Iam3R
0
171
Member Avatar for naziatarannum

[QUOTE=naziatarannum;1043636]hi Scott, Am getting this error for the code [code] Missing ] [/code] Please help[/QUOTE] Post your code the way you wrote it to execute. Make sure there's a space between [ and ]

Member Avatar for naziatarannum
0
144
Member Avatar for hosh

[QUOTE=hosh;1048346]Hi i'm trying to compile this code, but getting warning. need some help to understand what I'm doing wrong. [/QUOTE] Instead of [CODE] out = fopen ([COLOR="Red"]out[/COLOR], "w");[/CODE] it must be [CODE]out = fopen ([COLOR="Red"] filename[/COLOR], "w" );[/CODE] where filename is a string with the path to the file you …

Member Avatar for Aia
0
84
Member Avatar for vampgirl13

[QUOTE=vampgirl13;1047470]Hi, I was wondering if anyone can help me translate this into java. Thanks [/QUOTE] There's not such a mechanism of translating C to Java, except for the most rudimentary and simple statements. Since both languages are different, all that it can be done is to understand what the program …

Member Avatar for vampgirl13
2
112
Member Avatar for neithan

[QUOTE=gerard4143;1047847]This function returns the address of the local variable str [/QUOTE] Variable str is created when the function leer() is used. It is [1]destroyed when the function leer() is finished. You are returning a pointer to that memory that might or might not contain the previous declared value. [1] nothing …

Member Avatar for gerard4143
0
155
Member Avatar for imolorhe

[QUOTE=imolorhe;1045072]Please i need d code for C.[/QUOTE] The rules of this forum clearly explain that we do not give away code to posters that do not show proof of effort. Where's the code? Where is your effort in the matter?

Member Avatar for Calipe
-5
205
Member Avatar for whizkidash

What's the trouble? In its simplest form, create another executable script with three lines of text, where each line is the absolute path to those three scripts.

Member Avatar for sknake
0
216
Member Avatar for thure

[QUOTE=thure;1043316]That dismissed one of the warnings, but I still get a segmentation fault at [CODE]reply->option=o;[/CODE] Why is that even a problem?[/QUOTE] [ICODE]struct REPLY *reply;[/ICODE] is a pointer, anything you try to write to it it will produce a segmentation fault, since there's no memory allocated for it.

Member Avatar for Aia
0
166
Member Avatar for shakunni

shakunni >Anyone know why this is the case? A function must be called from another function block which could be the main function or one with a lineage to any main function. Meaning that main() must have been called first at some point. malloc() is a function and you are …

Member Avatar for shakunni
0
130
Member Avatar for FIG-GHD742

[QUOTE=FIG-GHD742;1044020] Can i edit or mark this thread as finhis?[/QUOTE] When you are the original poster you'd see at the bottom, after the last post, the mark as solved title, in blue. Click on it.

Member Avatar for Aia
0
130
Member Avatar for Mattpd

[QUOTE=Mattpd;1043573]If I have two lines of text: HOOK HOOK HOOK what is the syntax to grep just the first line without the second? and the second without the first?[/QUOTE] Find any difference between both and then match it. [B]e.g.[/B] with HOOK by itself in a line we can match the …

Member Avatar for Xydric
0
124
Member Avatar for MeBjess

To save the transaction you are almost there. [ICODE]int bal = 0; /* initialize balance to zero */[/ICODE] instead of[ICODE] bal = 0 + credit; [/ICODE]replace for [ICODE]bal = bal + credit;[/ICODE] or [ICODE]bal += credit;[/ICODE] which is a shortcut.

Member Avatar for MeBjess
0
115
Member Avatar for Iam3R
Member Avatar for Grn Xtrm

[CODE]if( line == pattern)[/CODE] That's a no-no, since line and pattern are strings and you can't compare arrays in that way. Take a look at the string function strcmp() for that. However, even if that would be correct, line is bound to have more characters read into, that the pattern, …

Member Avatar for Tajon Wong
0
3K
Member Avatar for miskeen

The controlling expression of a switch shall have integer type. An array of chars will not do.

Member Avatar for miskeen
0
130
Member Avatar for jodie121997

[CODE] if (data_size == SIZE_32 ) { * ( ((int32_t*)(new_node->data)) + index) = (int32_t) index*2 ; * ( ((int32_t*)(new_node-> data)) + index) = (int32_t) index*3[COLOR="Red"];[/COLOR] } else { * ( ((int64_t*)(new_node-> data)) + index) = (int64_t) index*4; * ( ((int64_t*)(new_node-> data)) + index) = (int64_t) index*5; } [/CODE] What's the …

Member Avatar for Aia
0
112
Member Avatar for auracabarcas

[QUOTE]hope you can help me with some advice. [/QUOTE] First, you must understand what constitutes a string in C. It is a sequence of chars terminated with a '\0'. So if I have this: [CODE]char fullname[] = "Jiminy Cricket";[/CODE] and I want to split it into name and last name, …

Member Avatar for Aia
0
914
Member Avatar for neithan

[QUOTE]How would you refer to the w in web at frases[1]?[/QUOTE] [CODE]frases[1][5];[/CODE] or if you want to complicate it [CODE]*(*(frases + 1)+ 5)[/CODE]

Member Avatar for neithan
0
162
Member Avatar for RobertMW

[CODE=c]fgets( student[count_s].name, sizeof (student[count_s].name), stdin );[/CODE]

Member Avatar for Aia
0
120
Member Avatar for neithan

[QUOTE=neithan;1029016]Oh, google, how didn't i though of that? [/QUOTE] Google: the response to much and the answer to nothing.

Member Avatar for Narue
0
191
Member Avatar for afnan1

Dear Sir/Madam: Certainly, you made the right choice to select this forum to ask your C programming questions. Nevertheless, you skipped two important requirements that must accompany YOUR posting questions. ~ You did not include any source code showing the trouble area of inquiring. ~ You did not read (or …

Member Avatar for Chilton
-1
136
Member Avatar for Iam3R
Member Avatar for Tom Gunn
0
996
Member Avatar for raigs

MONTH and MES are arrays of pointers to read-only memory. The value they are pointing to it can not be modified. It works the same way than if it were single pointers. [CODE]char *dia = "Lunes"; /* Lunes can not be changed because is a piece of memory fixed as …

Member Avatar for Aia
0
98
Member Avatar for Ismailworking

[QUOTE=Tom Gunn;1028577] [code] void PauseForUser(int promptUser, int clearStream) { if (clearStream) { int c; while ((c = getchar()) != '\n' && c != EOF) { /* all work in condition */ } clearerr(stdin); } if (promptUser) fputs("Press [Enter] to continue", stdout); getchar(); } [/code] In your code it might be …

Member Avatar for ankur_
0
10K

The End.