- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 18
- Posts with Upvotes
- 15
- Upvoting Members
- 7
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: [code] #!/bin/bash # we want to copy from path1 to path2 # step 1 make all the subdirectories find /path1 -type d | \ while read dir do mkdir /path2"${dir#/path1}" done # step 2 cp the files find /path1 -type f | \ while read $file do cp "$file" /path2"${file#/path1}" … | |
Re: DOS network programming is not directly supported by TURBO C. If someone assigned this task to you then that person must have some linkable files to supply TCP/IP support. This stuff is VERY old. TURBO C should be banned from classrooms. IMO. There were some network support libraries here: [url]http://alumnus.caltech.edu/~dank/trumpet/[/url] | |
Re: Use [code] mailx -r '<from name>' -s '<subject here>' john@somewhere.com < message_text_file [/code] | |
Re: shell programming and C/C++ are not the same thing. maybe a moderator will move your post for you. Anyway, in shell there is no way without writing code (the ncurses library provides calls to do this) without resorting to C/C++ code. Plus you have to be in graphics mode.... see … | |
Re: You will need 5 million different hash tables. Which meanns that if you are lokking for a given value, say -4, across all of your arrays you will have to consult each hash to see if -4 is in the array and which element it is. This will result in … | |
Re: Have you tried running it in a debugger? If you do a stack dump (backtrace) it will show exactly where it bombed. | |
Re: Can I make a suggestion before you spend six months learning this on your own? It may save your spouse, children, and pets endless hours of anxiety watching you bash your head into a doorframe. :) Richard Stevens book 'Advanced Programming in the UNIX Environment' spends about 90 pages on … | |
Re: Sounds like a class asignment. try a here document [code] oldpw="$1" newpw="$2" passwd <<EOF "$1" "$2" "$2" EOF [/code] | |
Re: All of the UNIX OS is written and maintained in C - well some asm. GLIBC, all of the the Linux stuff as well. What was your sample size when you came to this conclusion? | |
Re: [code] cat /proc/meminfo [/code] shows the current state of memory. The format varies somewhat with Linux distributions. My version of Linux has what you want in the 4 th column on the second line. So, you will need to get the awk statement working for you. Then put it in … | |
Re: Are you talking about using NFA regexp in a DFA environment? Start with a DFA tool is the simple answer. There really is no code to convert from one to another, because it doesn't make much sense to do so. C and C++ have regexp libraries available for them. Pick … | |
Re: Absolutely. C++ is used extensively in developing some components of games. | |
Re: You can pass the value to another function - and name the variable something else. But you are not gaining anything by doing that. [code] void refoo(int newname) { printf("variable newname=%d\n", newname); } void foo(void) { int oldname=13; printf(" variable oldname=%d\n", oldname); refoo(oldname); } [/code] As long the variable is … | |
Re: C version: returns pi/4 [code] #include <stdlib.h> double pi_over_4(int n) { double iter=3; int eveodd=1; double pi=0.; for(pi=1.; n>0; n--, iter+=2., eveodd=!eveodd) { if(eveodd) pi-=1./iter; else pi+=1./iter; } return pi; } [/code] | |
Re: If you don't want the user to notice the script running: [code] nohup script.sh <parameters> 2>&1 > ./logfile & [/code] As long as your script does not ask for user input this will work. Otherwise you will have to resort to nohup and an expect script or nohup and a … | |
Re: If you are in Unix: setitimer() and getitimer() have microsecond resolution on POSIX-compliant systems. Do you know about profiling and profilers? | |
Re: IF you're on unix: [code] sort -t ',' k- 1,1 -o newfile.csv oldfile.csv [/code] will sort the file the way you want - outside C++. | |
Re: Choices 1. install GNU date (the linux version) so you can use the --date option. Also check the man page for your current version of date - it may be a GNU variant. 2. use C's strptime() function and strftime() function in a small C program 3. install the DATE … | |
Re: I have no idea why the original coder wrote that stuff, except it appears the s/he did not know about the standard C library date/time functions. date arithmetic is best done with that library - convert a date/time to a struct tm, convert the struct tm to epoch seconds. Do … | |
Re: the functions count_char and test_letter_content are from something else, but they provide: an example of changing case a way to compare the letter content of two char arrays I put a "main()" on the code so you can see how it works. You will have to find a way to … | |
Re: [QUOTE=nehamore;525444]hey thanks for ur help but can u please elaborate on this...what should i add to my code so that it works the way i want it to work?[/QUOTE] It sounds like you are coding UNIX. From the man page for system: [quote] If the return value of system() is … | |
Re: date -u causes UTC date/time to be displayed - FYI. If you format date like this: today=$(date +%Y%m%d) you get a value like 20080111, this is a number - an integer. When you split the input reformat it: newdate="$cyear$cmonth$cday" then compare integers: if [[ $today -ne $newdate ]] then echo … | |
Re: FWIW - Oracle is as good as it gets on sorting. If the fields being sorted are indexed, you get maximum speed. We sort 200,000,000 records in 10-12 minutes - but that doesn't mean anything - performance is relative to the database schema and the available hardware. Sybase and DB2 … | |
Re: [url]http://www.freebsd.org/cgi/man.cgi?query=sysexits&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html[/url] | |
Re: What narue meant - flags were set so the compiler put symbol names in the image file. When flags are set NOT to output symbols, then you get assembler. | |
Re: Date arithmetic in shell is a pain. This link gives you several good scripts that do date compares and date arithmetic: [url]http://www.unix.com/showthread.php?t=13785[/url] | |
Re: Consider calling stat() to get the filesize first. Open the file, then move the file pointer forward to some arbitrary place. If you assume no last line is ever longer than say, 200 characters, then fseek() to within 200 character size units of the end of the file. fread in … | |
| |
Re: Short answer would be to have a while loop controlled by the totalinsert and money variables [code] while( totalinsert < money) { /* ask for money here, add it to total insert */ } /* you get here when you have enough totalinsert */ [/code] | |
Re: [code] for i in $(cut -f 1,3 -d: /etc/passwd) do echo "${i#*:}" "${i%:*}" done [/code] This lets you see what is going on. [code]${i#*:}[/code] is parameter substitution- returns the value just before the colon - a number that is the user id. [code]${i%:*}[/code] returns the username, so: arr[number] = name … |