1,088 Posted Topics

Member Avatar for chris5126

Variables in the shell are strings. Another utility is necessary to make the evaluation. [B]expr [/B]can do it, but has many "gotchas" that you need to be aware of, [I][B]e.i.[/B][/I] spaces, (), *, which need to be stripped of its especial meaning. [CODE=ksh]result=$(expr \( \( $obyte2 - $obyte1 \) / …

Member Avatar for chris5126
0
118
Member Avatar for bemo55

>Are they absolutely necessary to use them when passing arrays from functions ect. or is it just a more efficient way of doing so? It is the only way you can pass by reference. Further ahead in you education you'll learn that pointers shine when they are used in conjunction …

Member Avatar for ArkM
0
109
Member Avatar for drjay1627

[QUOTE=nucleon;799762]You need to increment the array index to point to the next element for each character read. Here's an example.[/QUOTE] A problem that arise of giving what appears to be a full working example is that normally it gets taken like correct and proper working code, free of bugs and …

Member Avatar for drjay1627
0
107
Member Avatar for drjay1627

>strncat(command_array, cmd, 100); //error on this line First let me ask you: what's in command_array? command_array can only hold 20 chars including the '\0' of which we don't know the content since it hasn't been initialized. You are asking strncat to inject to it a 100 char more from cmd, …

Member Avatar for drjay1627
0
148
Member Avatar for gornhorse

>Basically, I want to know why the second script returns the line: >[ICODE]Total size of files containing foo is: 0[/ICODE] [URL="http://www.nucleardonkey.net/blog/2007/08/variable_scope_in_bash.html"]Variable scope[/URL] problem in the while loop with | (pipe) More [URL="http://nion.modprobe.de/blog/archives/531-Altering-a-variable-outside-the-scope-of-a-loop-influenced-by-a-subshell.html"]here[/URL].

Member Avatar for eggi
0
153
Member Avatar for ohnomis

>may be its just a matter of luck and compiler sometimes. Yeah, like playing slot in Las Vegas. It's all about luck and compiler, right!

Member Avatar for Aia
0
168
Member Avatar for priyankasaini

[QUOTE=priyankasaini;798907]please write a programme to sort array of integers using quick sort[/QUOTE] No, you write it.

Member Avatar for Salem
0
81
Member Avatar for beanryu

>C just sucks!!!! Correction. You suck at C. Post the complete pertaining code.

Member Avatar for Salem
0
151
Member Avatar for Salem
Re: TV

[QUOTE=Ancient Dragon;797915]There is a great deal of truth in that video. I have dish network tv with over 100 channels to choose from, and there are days when there isn't a thing that I want to watch.[/QUOTE] The remainder deal of falsehood must be compelling enough for you to not …

Member Avatar for jbennet
0
64
Member Avatar for SagarVaze

Related to: [ICODE]n=(NODE)malloc(sizeof(struct node*));[/ICODE] Casting malloc is not necessary if the proper header file stdlib.h is included. Fail to check for a successful return of allocated memory. Fail to release dynamic memory. The code indentation has room to improve.

Member Avatar for Aia
0
2K
Member Avatar for moonw3ll

[QUOTE=Skorpion;795105]no suppose i tell u to print the odd numbers from1-20 then u have to print only odd numbers like 1 3 5 7 9 .....19 but the user can give u any point[/QUOTE] Whether in recession or not, you don't need to save characters. It is alright to say: …

Member Avatar for moonw3ll
0
259
Member Avatar for Rein Valdez

strchr() can find where the period is, the rest is the decimal part. strtol() can convert the decimal part into a long int.

Member Avatar for Aia
0
162
Member Avatar for RexxX

[ICODE]scanf( "%s", str);[/ICODE] will never include the newline into the string `str'. scanf() is designed in its default form to stop reading when it finds a space or newline. Bottom line. scanf() is a poor choice to read input string from stdin. fgets() is a favorite of many.

Member Avatar for death_oclock
0
115
Member Avatar for dhiliptce

Where's your question? Furthermore, this is a forum for the C language, and you are showing us an aberration of C++. Use proper code tags when posting source code. Read the rules or you'll be ignored.

Member Avatar for rajenpandit
0
120
Member Avatar for drjay1627

To encrypt: while string iteration of char = iteration of char + pre-determined character To decrypt: The opposite.

Member Avatar for drjay1627
0
161
Member Avatar for hsoni007

Salem gave you a hint already, but if you feel you need more I'll give you another. [URL="http://www.daniweb.com/forums/post364516.html#post364516"]Search for your answer first![/URL]; the first point from Read This Before Posting, at the head of the forum.

Member Avatar for riahc3
0
201
Member Avatar for number87

John, Manager, Finance, [COLOR="Red"]$[/COLOR]2000 Jack, Accountant, Finance, [COLOR="Red"]$[/COLOR]1500 If you take off the $ sign from the field value it might work. [Edit] Don't disregard Salem's advice. You're lucky I didn't noticed it before. I usually don't entertain posts from people that willingly ignores the forums conduct.

Member Avatar for Salem
0
151
Member Avatar for death_oclock

[QUOTE=death_oclock;787602] Wave.h: [CODE]#ifndef WAVE_H #define WAVE_H typedef struct { unsigned short formatTag; unsigned short numChannels; unsigned int samplesPerSec; unsigned int bytesPerSec; unsigned short blockAlign; } WAVE_INFO; typedef struct { WAVE_INFO *info; SAMPLE *data; } WAVE_FILE; [COLOR="Red"]bool getWaveData(WAVE_FILE *file, char *filename) { // function body, not important } void extractWaveFrames(FRAME *frames, …

Member Avatar for Aia
0
135
Member Avatar for mohinig

>what is the meaning of that? Your computer is mad at you for asking it to run a object file that for some reason doesn't exist. >and what should i do? Get your hands off the keyboard and step away from the computer. >please anybody help me. If you want …

Member Avatar for Salem
0
96
Member Avatar for Lovieron

>it does not work perfectly i don't know why That is a superfluous statement. It doesn't explain what the program is supposed to do. It doesn't explain what is doing that you don't want it to do. >but when i separate it its working.. And then you give us the …

Member Avatar for Aia
0
202
Member Avatar for mohan_198505

[ICODE]scanf("%[^\n]",str);[/ICODE] Do you want to bet I can overflow the 15 characters that str[] can hold? I would accept ( if I don't care about any extra left in the buffer ) that [ICODE]if ( scanf("%14[^\n]", str) == 1 ) [/ICODE]can fulfill the upper limit, but that's about it. Posting …

Member Avatar for Aia
0
116
Member Avatar for lonely_girl

Impossibility is playing a role in your distress. You could not have been born in two different months, nor could you have been born in a day that is earlier and later that a significant period, at the same time. There's an order of precedent as well to take in …

Member Avatar for lonely_girl
0
145
Member Avatar for slnvpraveen

In order to understand the sexual reproduction of snails, you must understand a key word: "hermaphrodite". Not the answer expected? Well, that's what you get when you don't ask any question. To hone the answer down, you need to be explicit. Use C language code tags to wrap your source …

Member Avatar for Aia
0
93
Member Avatar for Lovieron

>following function can be easily written as: No!, it can not be written as easily. [ICODE]char *s;[/ICODE] is a pointer to a char and you can not write to memory that it hasn't been allocated to it. Thus,[ICODE] scanf("%[^\n]",s);[/ICODE] is wrong, and so is [ICODE]p=strtok(s," ")[/ICODE]; since strtok need to …

Member Avatar for Lovieron
0
141
Member Avatar for akim_atl

>I wrote this program and I need to know if I didn't make a mistake Would you care to know if you did? [ICODE]void main()[/ICODE] is in opposition to the standard. It should return an integer. Therefore the proper code would be[ICODE] int main(void)[/ICODE] in your case. It is time …

Member Avatar for Aia
0
92
Member Avatar for atman

[QUOTE=atman;781628]depends on the pass if its the first pass then 0, if second then 1, e.c.t...[/QUOTE] Nope. That [B]i[/B] has the value of "segmentation fault". It never gets initialized. If you want to pass it a value you need to do it as an argument. [ICODE]void enter(int *p_arr, [COLOR="Red"]int i[/COLOR]);[/ICODE] …

Member Avatar for atman
0
122
Member Avatar for mohan_198505

>i want to write a code so that output will show the dept name and no. of employee in that dept in the tabular form. Start doing it, and stop wasting your time posting the assignment. Show us your efforts.

Member Avatar for death_oclock
0
92
Member Avatar for sotiris25s

>please give me all your help i need this soo much its my exams tomorrow and i really need help.thanks in advance! Sure, tell me the e-mail of your professor at school and I'll ask him to give you a break.

Member Avatar for ajay.krish123
0
196
Member Avatar for RenFromPenn

Read your reference material about how the standard fscanf() function works. While your are there, read about gets() as well. If it is a good reference it would tell you to never use it.

Member Avatar for ajay.krish123
0
140
Member Avatar for orwell84

Whenever you log-in or open a new terminal window that starts the shell to run, a series of scripts are executed to establish the environment in which it is to run. These scripts contains commands just like if you were to execute them in the command line. ~/.bash_profile and ~/.bashrc …

Member Avatar for Aia
0
207
Member Avatar for taichou

Your indentation could use some more noticeable spaces. [ICODE]#include<conio.h>[/ICODE] is not a standard header file. [ICODE]clrscr();[/ICODE] and [ICODE]getch();[/ICODE] are not portable C standard functions. [ICODE]void main()[/ICODE] should always return an int, except when there's not host operating system. [ICODE]printf("enter the name:");[/ICODE] you ask for a name, but expect six to …

Member Avatar for ajay.krish123
0
125
Member Avatar for Somali Rathore

[QUOTE=Freaky_Chris;781150]Do you feel the need to echo me?[/QUOTE] It is not uncommon for two people to post about the same solution or idea, without knowing or being aware of each other, since the browser doesn't refresh until the post has been committed.

Member Avatar for Aia
0
196
Member Avatar for titosd

main() returns an int. Why? Click [URL="http://www.daniweb.com/forums/post764936-4.html"]here[/URL] gets() is not a function that you should use. Why? Click [URL="http://www.gidnetwork.com/b-56.html"]here[/URL]. Some improvement in proper indentation would make it easier to read. Click [URL="http://www.gidnetwork.com/b-38.html"]here[/URL].

Member Avatar for Aia
0
146
Member Avatar for Salem

[QUOTE=vmanes;779133]And the point would be?[/QUOTE] To make better highways for air planes. They should patent the technology, you'll never know when the idea might "sky-rocket".

Member Avatar for Aia
0
71
Member Avatar for d0ne

Could you post what you have done so far? In that way we'll know at what level you are at learning, and tailor a help for you. Make sure you read the proper way of tagging code before hand.

Member Avatar for Sky Diploma
0
88
Member Avatar for Aia

You ain't seen nothing yet. But [URL="http://news.cnet.com/8301-13578_3-10133425-38.html"]this is[/URL] part of the promised change.

Member Avatar for GrimJack
0
183
Member Avatar for Salem

[QUOTE]Police say that such methods are necessary to investigate suspects who use cyberspace to carry out crimes. These include paedophiles, internet fraudsters, identity thieves and terrorists.[/QUOTE] These days, any state craving control over citizenry thinks that throwing the word "terrorist" or "a variation for undesirable" is justification enough. The sad …

Member Avatar for Dave Sinkula
1
162
Member Avatar for Marks256

[B]@ Marks256[/B] [quote]Does anyone here own the book (Programming Windows by Charles Petzold fifth edition)? If so, can anyone give me some ideas of what they cover (at how much detail is given)? I am literally starting to panic... [/quote] Check your mail box, I sent you some information about …

Member Avatar for massivefermion
0
180
Member Avatar for skynwa

>Why do you think i should rethink whole function? Could you be more specific? You are passing copies of arguments that don't need to be passed as parameters? Indexes like i and j don't need to be part of arguments in a function; they can be local declared to the …

Member Avatar for Patel S
0
267
Member Avatar for jinsonsani

[QUOTE=jinsonsani;771183]I want to replace a text in a file eg (old_text) with another text eg (new_text) . new_text is a variable in my shell script. few methods that i tried .. but this doesnt work cat $line".sh" sed -e 's/abc/ABC/g' $line".sh" sed 's/ordprg/new_string/g' $line".sh" > $line".sh" Could some one can …

Member Avatar for eggi
0
169
Member Avatar for brimble2010

>any chance you could explain what I was doing and what strcpy() does differently, just for future reference? [CODE]char *linep = malloc(sizeof(char) * 1000);[/CODE] malloc sets apart the memory you specified. And you keep track of that memory via the pointer [B]linep[/B] But that pointer can be reassigned to point …

Member Avatar for brimble2010
0
138
Member Avatar for RenFromPenn

[ICODE]fscanf(inFile, "%s", text)[/ICODE] Think for a moment, what does text need to be?

Member Avatar for Ancient Dragon
0
885
Member Avatar for RenFromPenn

Have you first tried to learn how linked lists work? [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]Here[/URL].

Member Avatar for Aia
0
190
Member Avatar for RenFromPenn

[B]Please help me fix these errors[/B] is the perfect title to be ignore. Next time avoid such "Please, help me" titles. >"error C2664: 'sprintf' : cannot convert parameter 2 from 'int' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast" [ICODE]sprintf() …

Member Avatar for Aia
0
347
Member Avatar for revenge2

>I have been afraid of Vim editor, due to NO-knowledge. Practice will change that. Learn as you go according to your need. Vim has much to offer, but until you start using it, you'll will not know what it is applicable to you in your way of writing. Thanks for …

Member Avatar for mn_kthompson
0
122
Member Avatar for nrupparikh

[QUOTE=sneekula;769500]There is "no beauty" in even simple C code! [/QUOTE] "Beauty is only in the eye of the beholder". Those that know, find a well written piece of code in C very motivating and easy to work with. The comparison of languages as it has been described here, only shows …

Member Avatar for Aia
-1
151
Member Avatar for GrimJack
Member Avatar for Blackeagle
Member Avatar for codedhands

Group: [0-9]\n{1}#.*$ Setting aside the fact that that regex would not match any of the text you gave as an example, the key to understand your problem is `.*$`. That's a greedy "match regex", it will match any character until it encounters the end of line; not the first one …

Member Avatar for codedhands
0
107
Member Avatar for AhmedHan

[QUOTE=EZO;765869]Peace... Can anyone explain that more, step by step.[/QUOTE] [B]First[/B], you read the date that conversation was initiated. [B]Second[/B], you start a new thread, making sure you have done your part to follow the rules of posting. [B]Third[/B], you link or point to the old conversation, if it is relevant …

Member Avatar for EZO
1
371

The End.