1,494 Posted Topics
Re: [QUOTE=y_alhasa;1162485]We are asked to write a NASM program that will read a list of 10 2-digit integers, and output them in a column. At the base of the column, give the average value of the set of integers.[/QUOTE] I'm not a NASM fluent person but do you mean two digit … | |
Re: This would make more sense if you posted the skeleton code along with the explanation... | |
Re: Try this instead fgets fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after … | |
Re: Please post your program and indicate the areas your having problems with... | |
Re: Man has this bug BUGS sleep() may be implemented using SIGALRM; mixing calls to alarm(2) and sleep() is a bad idea. Using longjmp(3) from a signal handler or modifying the handling of SIGALRM while sleeping will cause undefined results. | |
Re: Most/all C/C++ compilers have a swtich to allow you to view the assembled code gcc's switch is -S `-S' Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code file for each non-assembler input file specified. | |
Re: [QUOTE=pikesh;1158783]what is lvalue required in turabo c++,Hoe i can solve this type of error?[/QUOTE] Its probably means you need to have an assignable value on the left hand side.. example: [CODE] #include <stdio.h> int main(void) { int x = 0; 5 = x; return 0; } [/CODE] generates a compile … | |
Re: [QUOTE=ravikiran32;1158373]i have written small c language code to execute "dir" command which displays directories and files in the current directory, using system() function in c. But my code doesn't work. please help me. [CODE]# include <string.h> # include <stdio.h> # include <stdlib.h> void main() { clrscr(); system("dir"); getch(); }[/CODE][/QUOTE] You … | |
Re: Or you could try Gawk/Awk [CODE] awk '{for (i = 2; i <= NF; ++i){printf("%s ",$i);{if (i==NF){printf("\n");}}}}' filename [/CODE] | |
Re: The thing is...If you can execute the line in a bash terminal then you can include it in a bash shell script bash.sh [CODE] #! /bin/sh ...your steps go here 1. mount /dev/sda1 /mnt/usbdisk 2. rsync -av /mnt/usbdisk/content*.mpg /mpgfiles --progress 3. Wait for the rsync to finish - perhaps show … | |
Re: Tried compiling your program but.... prg1.c: In function ‘main’: prg1.c:20: warning: ISO C90 forbids mixed declarations and code prg1.c:23: error: ‘stock’ undeclared (first use in this function) prg1.c:23: error: (Each undeclared identifier is reported only once prg1.c:23: error: for each function it appears in.) This head=(struct stock*) malloc(sizeof(stock)); should be … | |
Re: Maybe you should check out those 'warnings' the compiler generates them for a reason..You should never ignore a warning unless you have a valid reason. Also never and I mean never use gets() This will print your prompt...and compile without warnings or errors...your code had a few [B]errors[/B]. [CODE] #include … | |
Re: Here's an example: But first - create a text file mydata and put some text in it.. [CODE] #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char**argv) { char ch[100]; int infile, outfile; infile = open("mydata", O_RDONLY, 0666); if (infile < 0) { fputs("could not open infile!\n", … | |
Re: [QUOTE] My input file contain: 1 2 3 4 5 6 [/QUOTE] Are the file values integers or ascii text? | |
Re: [QUOTE=phil750;1152503]Im mid way through writting my own c shell and having trouble with my redirecting, i use strtok to spilt the input into 2 parts, argv0 being command and argv1 being cmd i have this for redirecting so far [code] if(strcmp(cmd,">")==0) { strcpy(filename, command); filein = open(filename, O_RDONLY); dup2(filein,0); close(filein); … | |
Re: [QUOTE=DarkC0de;1152534]hi when I use this with my program i have msg tell me about the warning in my program please any one explain it thanks[/QUOTE] ggdb [QUOTE] `-ggdb' Produce debugging information for use by GDB. This means to use the most expressive format available (DWARF 2, stabs, or the native … | |
Re: Do you have access to man or info? | |
Re: [QUOTE=donelliewhyte;1150567]IF i write to file REGISTRATION NUMBER :1001 how can read back from the file the 1001. Thank you for all your help,i have gotten other hints but they don't seem to work[/QUOTE] Well lets see what you've done with some of your hints. | |
Re: [QUOTE=alcapone11;1148854]hi, i'm beginner in assembler, i'm just start study this language... please can someone explain me, what do this two functions? cbr flags, (1<<pressed) ;Clear status flag sbr flags,(1<<pressed) ;Set status flag please if you insert example, it will be only better...:)[/QUOTE] These above instructions...which machine do they go with? | |
| |
Re: Try setting hold[0] = '\0'; Or you may try using buffer[0] == '|' | |
Hi, I wrote this simple bash script(yeah simple now that its done) and it uses bc - 'The arbitrary precision calculator language' and tr - 'translate or delete characters'. Now the script works, it will take input values and convert them to the proper output values. Now my question is..is … | |
Re: Scanf isn't clearing the input buffer of the new line character.. i.e. When you enter an operator you enter the operator character plus you hit the return key...So two characters are placed in the input buffer, the one you want plus the newline character and scanf only picks up the … | |
Re: Most C++ compilers offer a setting to stop compiling.. In GNU its g++ file.cpp -S [QUOTE] `-S' Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code file for each non-assembler input file specified. [/QUOTE] | |
Re: The rule is - for every malloc you call, you have to call free.. | |
Re: Just tried your code on my machine(64 bit) and it worked... | |
Re: Can you post an objdump of the code? I want to see how Nasm is addressing message db "Hello, world!", 0 If you can't provide an objdump of the code then try moving message db "Hello, world!", 0 to the end of your code....Initially your instruction pointer may be trying … | |
| |
Re: [QUOTE=miskeen;1142848]Hello, I've an external/global array that is used every where in my code.[CODE] // global.h file short is_valid[10];[/CODE] I initialize my array somewhere in the code and I want to check if everything works. When I try to print the values of the array, I get segmentation fault. [CODE] // … | |
Re: Are you talking about a variable length argument list? If you are then google "C variable length argument list". | |
Re: Is there a question hidden in your posting? | |
Re: [QUOTE=Narue;1141767][B]>Its urgent[/B] For future reference, stating that your problem is urgent will likely be counterproductive. A lot of us are perverse enough to ignore you solely because you're in a rush. [/QUOTE] Sad but true... | |
Re: [QUOTE=gplkrsna;1141612] I have two libraries with two different queue implementations. but with same structure name as "queuetype". [/QUOTE] Question - are the structures queuetype the same in both files(besides the name)? | |
Re: why do you define your int like this long int &max; with the "&"... Don't you mean long int max; | |
Re: [QUOTE=johndoe444;1141232]I figured my stupid silly mistake. children[i+degree] is not a pointer. What punishment do you suggest to give johndoe for such a moronic act?[/QUOTE] How about getting you to post this in the C++ section [QUOTE] Note: I used g++ to compile this. How to change things to compile without … | |
Re: Why can't you send integers with write.... [CODE] int myint = 1234; write(fd, (char*)&myint, sizeof(int)); [/CODE] | |
Re: Download/install qemu and then use it like qemu bootimage | |
Re: Is this me or does this look like C++ list<item_set> candidate_set; | |
This is a Linux brainteaser for the C comfortable and leisurely bored. I'm not looking for the answer.. Note the compile lines are commented at the bottom of the program - Ubuntu and derivatives please use the second compile line or it will not work. So what does this program … | |
Re: Since this program has some problems, could you tell us in words what you are trying to do here. | |
Re: Do you mean calling a function or defining a function. | |
Re: I would check out this link [url]http://en.wikipedia.org/wiki/C_preprocessor[/url] especially the section 'Conditional compilation' | |
Re: Try googling stdio Or you could start here [url]http://en.wikipedia.org/wiki/Stdio.h[/url] | |
Re: [QUOTE=newcuser;1135856]I am trying to input a text file with twenty unsorted names in it into an array and then perform a bubblesort and output to a new file. The filename for the txt file is names.txt Here is what I have so far....not much...I would appreciate some help the right … |
The End.