1,088 Posted Topics

Member Avatar for Philmagrill

>sunny╠╠╠╠╠╠╠ >do you know why this is? Most likely because no null terminator '\0' is finishing the string.

Member Avatar for jephthah
0
109
Member Avatar for sprok

Instead of : [CODE]sed -ie "\|^$JOBNAME\$|d"[/CODE] try: [CODE]sed -ie "0,/$JOBNAMES/{//d;}" filename[/CODE] The workhorse bit is "0,/RE/". It looks from starting line until first occurrence of REGEX >I really am a newbie to scripting but working hard to learn the way of the force. Here's [URL="http://www.tldp.org/LDP/abs/html/"]the tools[/URL] to construct your [I]"light …

Member Avatar for sprok
0
107
Member Avatar for Nick Evan

Could it be [URL="http://redwing.hutman.net/~mreed/warriorshtm/rottweilerpuppy.htm"]Rottweiler Puppy[/URL]?

Member Avatar for Narue
0
320
Member Avatar for GarethSmith

You know at least this is not C but rather C++, right? OP> the main errors are in with "for(i=0; i[COLOR="Red"]&lt;[/COLOR]MAX; i++)" this part of the code but i can't see whats wrong. [ICODE]for ( i = 0; i [COLOR="Green"]<[/COLOR] MAX; i++)[/ICODE] is the correct syntax.

Member Avatar for Aia
0
203
Member Avatar for meghs007

OP> pls post the source code Yes, please, [URL="http://www.daniweb.com/forums/announcement118-2.html"]post the source code.[/URL]

Member Avatar for Aia
0
70
Member Avatar for WarB1rd

OP> In the print function it gives me this error: aggregate value used where an ineteger was expecter. Did you get why? [CODE]printf("O número de operadores livres é %[COLOR="Red"]d[/COLOR]\n",((int)nume - x))[/CODE] OP> I already tried to make a cast to int but it still give me this error. Casting is …

Member Avatar for WarB1rd
0
4K
Member Avatar for usman2k4u

[QUOTE=usman2k4u;841980]Write a Program to generate a random connected undirected graph on a n vertices by generating random pairs of integers between 1 and n. Compute how many edges are needed to produce a connected graph(as a function of n). Implement the union-find algorithm, with the Weighted Balancing and the splitting …

Member Avatar for usman2k4u
0
286
Member Avatar for blueman

[URL="http://www.linuxquestions.org/questions/programming-9/bash-programming-create-a-menu-307345/"]Maybe[/URL]?

Member Avatar for Aia
0
104
Member Avatar for #include_rose

>or use it for your school work Yeah, tun it in for a grade. Don't be surprise of the [B]F [/B]afterwards. char word[10] scanf("%s",&word); Word is a string. So, you don't need the & in the scanf function.

Member Avatar for jephthah
0
213
Member Avatar for ravikiran032

>the code is running but it i not deleting files. I'm skeptic that this script runs properly. To start [B]kiran.txt[/B] is in the same current directory that you are trying to delete *everything*. And just in case, DEL only deletes files, but not directories.

Member Avatar for rm_daniweb
0
151
Member Avatar for oracle123

[QUOTE=Narue;846819]>le sigh. :D It seems you've suffered enough for that bit of code, so I'll restrain myself.[/QUOTE] Must you? Could we encourage you to change your mind? For the good of the community, please? :D jephthah, don't worry I'll try to bandage you up afterward. :P

Member Avatar for jephthah
0
4K
Member Avatar for want_to_code

>I don't hide the fact that I'm an jerk. I'm really good at it too. Go ahead, ask anybody on Daniweb. I'll wait. I am confused! The dictionary says: [B]Jerk[/B] - [I]a dull stupid. fatuous person[/I] Synonym: [B]dork[/B] - A stupid, inept, or foolish person. But I don't see any …

Member Avatar for Nick Evan
0
299
Member Avatar for alanng.net

This source code is plagued with syntax errors. [ICODE]printf ("word: <%s>\n", w);[/ICODE] requires the header file stdio.h [CODE]int set_keysig ([COLOR="Red"]type[/COLOR] s, [COLOR="Red"]type[/COLOR] ks, [COLOR="Red"]type[/COLOR] init)[COLOR="Red"];[/COLOR][/CODE] Prototype missing [B]; [/B]and type, where type is any data type like int, float, structure, pointer, etc. [ICODE]char s[[COLOR="Red"]x[/COLOR]];[/ICODE] length of string needs to be …

Member Avatar for alanng.net
0
124
Member Avatar for Dave Sinkula

[QUOTE=VernonDozier;706766] Whatever "Conservative" used to mean, if Conservative != Republican, then Conservatives should be really angry at the Republican Party because they've redefined the words to be synonyms.[/QUOTE] No political party has the monopoly of conservatism. If you keep bringing the Republican Party up, I am going to think you …

Member Avatar for jephthah
0
666
Member Avatar for JimD C++ Newb

>Where do these symbols come from? Like the Origin of Life, some call it a mystery; others call it a miracle. [CODE]printf ("There are %d vowels. They are: [COLOR="Red"]%s[/COLOR]\n", vCount, vowels);[/CODE] vowels is never terminated with the '\0' which would have made it a string. Forcing printf() to keep displaying …

Member Avatar for Aia
0
117
Member Avatar for clutchkiller

[QUOTE=vicio;791425]...and who said Osama was the leader of the group that hit the twin towers? I think you need to do some deeper research. It was Mussad people who did it![/QUOTE] Research is as foreign to his understanding as writing would be to a monkey. And this is not an …

Member Avatar for GrimJack
1
316
Member Avatar for sivak

>That's not entirely true Repeating code unnecessarily, and stubbornly forcing the use of a function that was not designed to be used as it would have been in Pascal/FORTRAN. No wonder the practice keeps popping up all the time, since people that knows better continue to perpetuate the "possible" use …

Member Avatar for Aia
0
399
Member Avatar for want_to_code

[QUOTE]#include<stdio.h> #include<math.h> int main(main) { printf("\n%d",main+=pow(++main,++main)); return 0; }[/QUOTE] >what does the above program do with "main"? A mockery of the C Standard, and a massive example of undefined behavior.

Member Avatar for Aia
0
174
Member Avatar for lehe

Your script doesn't make any sense, however I am going to guess some. If you want to itinerate through the array ids you are missing something [CODE]for ((i=0;i<${#ids[COLOR="Red"][@][/COLOR]};i++)); do [/CODE] [QUOTE] > ${TMP} < ./results/$1${ids[${i}]}/test_error.dat[/QUOTE] That redirection is all backward. It would have been < inputfilename > outputfilename. However awk …

Member Avatar for Fest3er
0
172
Member Avatar for pdrino

[QUOTE]You can try this one...... char* str; while (fscanf(inp, "%s", str) != EOF) { [/QUOTE] What size of memory is [B]str[/B] pointing to? You don't know. You haven't given it any meaningful space of memory. Therefore you cannot use it with fscanf(), because it will overwrite unknown memory.

Member Avatar for Aia
1
2K
Member Avatar for MaestroRage

>Do I have to take any extra measures to make sure the redirection is handled properly? Let's say you want to read some input and display it. [CODE=C]#include <stdio.h> int main(void) { int ch; /* read character by character from stdin */ do { ch = fgetc(stdin); putchar(ch); } while …

Member Avatar for Aia
0
13K
Member Avatar for bobrien314

Any argument passed in the command line is going to be a string as you seems to know. However, casting it to just an int is not going to help. You need to convert that string numeric representation into an integer. You could parse it using sscanf() or maybe convert …

Member Avatar for bobrien314
0
85
Member Avatar for wasge

I don't know what the function [ICODE]gtk_button_new_with_label()[/ICODE] does since it is not prototyped in the code you provide, however, it appears that returns a pointer and not an int. Making all the errors part of the same problem. [QUOTE]vass.c:80: warning: assignment makes integer from pointer without a cast [/QUOTE] That's …

Member Avatar for wasge
0
197
Member Avatar for headacheinC

>while(!feof(file)) I glanced very quickly to your last post and saw that. feof(file) would never give you the expected result as a loop control. See [URL="http://www.gidnetwork.com/b-58.html"]here[/URL] for some explanation. Furthermore that for loop will continue regardless if fscanf() can read a conversion or not. It should be able to stop …

Member Avatar for headacheinC
0
98
Member Avatar for austinslik

[code]cout<<unsort[i]<<" "; cout <<unsort[y];[/code] These are not valid C programming statements.

Member Avatar for austinslik
0
122
Member Avatar for c++noobie

[URL="http://linux.wku.edu/~lamonml/algor/sort/merge.html"]Merge Sort Algorithm Analysis[/URL]

Member Avatar for c++noobie
0
110
Member Avatar for wasge

If I understand you correctly, you want to create variables dynamically at run time. No. It is not possible. C is strongly typed. Variables need to be declared before hand.

Member Avatar for wasge
0
229
Member Avatar for BunnysMom

Let's see if I can help you to clarify what you are doing. When you want to work in a file, you have to open it regardless it is for reading or for writing in it. The path where that file lives needs to be specified in absolute path if …

Member Avatar for Aia
0
182
Member Avatar for agunning

[CODE]fscanf(fi, [COLOR="Red"]"[/COLOR]%f[COLOR="Red"]"[/COLOR], &Temp);[/CODE] The float format needs to be made a string with " " marks.

Member Avatar for BunnysMom
0
105
Member Avatar for drxs33

>it should say that the user entered an invalid box number. but it stops scanning when the user enters a char variable. Actually, if the variable [B]n[/B] is initialized to or contain random data ( not initialized ) to something equal or bigger of 1 and equal or less than …

Member Avatar for Aia
0
78
Member Avatar for jenilgandhi

[CODE]ptr=[COLOR="Red"](int *)[/COLOR]malloc(n*n*sizeof(int));[/CODE] Casting malloc is a residue practice from the times when the C programming language didn't support void type. It is best not to cast malloc since doing it can hide errors. [ICODE]#include <stdlib.h>[/ICODE]

Member Avatar for Aia
0
82
Member Avatar for csurfer

>And my earlier query of why [QUOTE]#define int float [/QUOTE] >is still not clear... You are substituting in your code, every word [B]int [/B]for the word [B]float[/B]. That's all. So, what happens when for example you write? [CODE]float main(void)[/CODE] It doesn't work properly, correct? Because main should return an int.

Member Avatar for csurfer
0
144
Member Avatar for Dave Sinkula

[quote=WolfPack;394730] Actually humans started smoking because they ARE of superior intelligence.[/quote] And then the smoke got to our heads.

Member Avatar for jbennet
0
4K
Member Avatar for Bhoot

>I wrote the solution in awk using substr() : [QUOTE] awk '{ if (substr($0,2,1) == substr($0,3,1)) print $0; }' emp.list[/QUOTE] A slightly different approach. Since the targets to compare are found always in the beginning, use only the first field. Separate individual characters using split and then compare. [CODE=awk]awk '{ …

Member Avatar for ghostdog74
0
298
Member Avatar for PRATS 1990

[QUOTE=PRATS 1990;831769]Whats the use of switch(ch) in c?[/QUOTE] This is an irritating question; classified in the section that says: if you can not make use of a search engine and make a simple research on it, you don't have any business learning how to program.

Member Avatar for csurfer
0
116
Member Avatar for phalgun_g

>Writing programs for chess is too difficult and such complex calculations can be done practicallly only by supercomputers Darn! I knew that my Sony CLIE pda was a powerful machine, but I had no idea of its true supercomputer nature. ;)

Member Avatar for MosaicFuneral
0
161
Member Avatar for chris5126

Assuming data format: [QUOTE]d15 509MB c1t0d0s5 d13 7.0GB c1t0d0s3 d11 1.5GB c1t0d0s1 d10 10GB c1t0d0s0 d25 509MB c1t1d0s5 d23 7.0GB c1t1d0s3 d21 1.5GB c1t1d0s1 d20 10GB c1t1d0s0[/QUOTE] For example purposes coming from datafile to awk and displaying to standard output. Modify to need. [CODE=awk]awk '/s/ { if ( index($2, "GB") …

Member Avatar for Aia
0
245
Member Avatar for PRATS 1990

Is your keyboard broken? It looks like sticky key with (!), (,) and (?). Do you know that ALL caps represents YELLING! Not cool! Stop yelling at people you don't even know. Learn how to use a loop, and include the scanf() inside one.

Member Avatar for PRATS 1990
0
228
Member Avatar for littlespy

[QUOTE=Ancient Dragon;831115] [code] int spot = 0; int c; while( (c = fget[COLOR="Red"]s[/COLOR](fp) ) != EOF) { string[spot++] = c; } string[spot] = 0; // null-terminate the string [/code][/QUOTE] He really meant [ICODE]while((c = fget[COLOR="Red"]c[/COLOR](fp) != EOF)[/ICODE] And some further information. You really need to pass it a limit of …

Member Avatar for Aia
0
160
Member Avatar for mizzwaniez

You came to the right place, but entered the forum with the wrong foot. I can notice a difference between the quality of writing of the first paragraph and the second paragraph. Which tells me you just copied and pasted your assignment. We don't give assignment completion away. Heck!, some …

Member Avatar for moonw3ll
0
90
Member Avatar for lml108

>Why the variable $number is losing its value outside while loop even though it's a global value? It has to do with the pipe Read [URL="http://nion.modprobe.de/blog/archives/531-Altering-a-variable-outside-the-scope-of-a-loop-influenced-by-a-subshell.html"]here[/URL] and you might know why

Member Avatar for fpmurphy
0
114
Member Avatar for chris5126

Try this and see if you can figure out: [CODE=bash]echo "2.3 4.56789" | awk '{printf "%.2f %.2f\n", $1, $2}'[/CODE]

Member Avatar for Fest3er
0
2K
Member Avatar for BlackIris
Member Avatar for Aia
0
94
Member Avatar for deepugtm

[QUOTE=deepugtm;817308]I use Turbo c ,How can I make that program,I use Windows Xp.[/QUOTE] Turbo C is not an adequate compiler for Windows XP. This is a helpful [URL="http://www.daniweb.com/forums/thread50370.html"]link[/URL] to modern compilers.

Member Avatar for csurfer
0
138
Member Avatar for revenge2

[QUOTE=jenilgandhi;817306]hey i.e. int i=1; while (i<=60) { printf("#"); i++; } or do { printf("#"); i++; }while(i<60)[/QUOTE] Posted source code must be wrapped between proper tags that will display it in a consistent format and familiar neatness. Example shown [URL="http://www.daniweb.com/forums/thread93280.html"]here [/URL]

Member Avatar for Aia
0
133
Member Avatar for jenilgandhi

Post the code you have done so far. Explain where you are having problems with.

Member Avatar for Aia
0
104
Member Avatar for chriscross86

>True, what about if you're making a graph... and need to plot some x & y coordinates, what would be more readable? Since we are splitting hair, let's declare those [B]int[/B] variables outside those [B]for[/B] loops. Portability to the lowest common denominator should be a concern.

Member Avatar for Dewey1040
0
102
Member Avatar for jared717

>I found it and don't understand how to run it It runs in the command line and expects three arguments: The name of the program <space>the file name to be copy<space>the file name to be created as a copy. Mind that this is not a particular well written program.

Member Avatar for abhishaki
0
195
Member Avatar for Skorpion

[URL="http://linux.wku.edu/~lamonml/algor/sort/index.html"]For the heck of it.[/URL]

Member Avatar for TheBeast32
0
152
Member Avatar for slimjimmer

>(I think I'm over running an array but can't see where). [CODE]table[[COLOR="Red"]15[/COLOR]][1] = 0;[/CODE] To start, table can only be indexed to 14 >(anything at all!) There's not guarantee that malloc will allocate memory. You MUST check the return of that call. Where do you free the malloc()ed memory that …

Member Avatar for slimjimmer
0
151

The End.