- 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
152 Posted Topics
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>' [email protected] < 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 … | |
Re: Do you mean 'will the compiler complain' - no. 'Is it a good idea' - Again, probably not. Reentrant functions should have all of their data passed to them as arguments, and not use global data structures. Semaphores are traffic cops for access to global objects or shared objects. This … | |
Re: try: [code] #!/bin/ksh export infile=filename filedate() { perl -e ' use Time::Local; $mytime = timelocal(0,$ARGV[4],$ARGV[3],$ARGV[1], $ARGV[0] - 1,$ARGV[2] - 1900); print "$mytime\n"; ' $1 $2 $3 $4 $5 } compare() { keep="None found" maxallowed=$1 minallowed=$2 result=$minallowed while read record do echo "$record" | tr -s '/' ' ' | tr … | |
Re: Code caving creates a supplanting vector to user-controlled data sets, and is usually a game hacking technique, it's also used in exploits. Therefore, it's usually an asm code block. More than that is totally game-specific and platform-specific information that you'd only get at gaming cheat sites that had forums dedicated … | |
Re: I should have read this earlier. The answer is no. Unless you are using the Realtime Signal Extension - ie., "realtime signals". The real question is "Why are you doing this?" It's not like there aren't USR signals or realtime signals (lots of them) you can't use. No offense, but … | |
Re: If this is any version of unix: [code] grep -v "connected" filename > newfile[/code] deletes all of the lines having the word: connected | |
Re: You have to use either ksh (zsh) or bash to do this - ie., a modern shell with pattern matching. [code] cd /path/to/files find . -name '*.err' |\ while read file do tmp=${file%%.das*} mv $file "$file".das done [/code] Test it somewhere first! | |
Re: try: [code] # find $1 -type f -exec grep -l -e '/*' -e '//' {} \; | while read file do grep -q ';' $file if [[ $? -ne 0 ]] ; then echo $file | grep -q -e '\.c$' -e '\.h$' if [[ $? -ne 0 ]] ; then … | |
Re: You need to use sed, and you have to learn about regular expressions. based on your data a very specific (not generalized) solution is: [code] $> echo "Here's some text and ~this bit gets removed~, where tilda is the delimiter." |read var $> echo $var Here's some text and ~this … | |
Re: [code] sed 'n;s/$/;/' filename > newfilename [/code] | |
Re: This will generate a report like you asked for. [code] nawk ' { shortcode[$11]=$11 causecode[$12]=$12 result[$11 $12]++ } END{ for( short in shortcode) { for(cause in causecode) { if(result[short cause]) { print short, "count", cause, result[short cause] } } } } ' filename [/code] You will have to write another … | |
Re: It looks like you're trying to automate vi. There are such things as "ed scripts" - scripts that invoke the ed editor. You can use that scripting language easily. vi presents problems because it expects the terminal to be a tty, ed doesn't. Your stdin is a shell script. man … | |
Re: It's telling you that you're referencing NULL pointers. | |
Re: [code] for i in vs01a vs01b do for k in 1 2 do rsh $i echo $(tail -20 /opt/oracle/admin/+ASM/bdump/alert_+ASM"$k".log) >> VS_logs.txt done done[/code] For "rsh" do you mean rexec or remsh? Or does rsh create a remote shell on remote systems using your OS? | |
Re: script: [code] # $1 = path to examine # usage # myscript /path find "$1" -type d -print |\ while read file do permissions=$(ls -l $file | awk '{print $1}') echo "$permissions $file" done [/code] | |
Re: UNIX only: [code] getenv("TZ"); [/code] will return the timezone setting. The result is in the form xxxNxxx, example MST7MDT. TZ has to be set for localtime() to return the correct time. MST is GMT +7. If TZ is not set the system is running GMT by default. Assuming time has … | |
Re: But yiu have to put the integer values out ther in the file in such a way that you can guarantee a read, ie, put it on a separate line with demarcation so you can see it is not part of the list (in case you forgot to write it … | |
Re: su or sudo Read the man page for su. Both of these require superuser (root) access. | |
Re: [code] file_name=`echo "$file_name" | sed 's/ //g'` [/code] That removes any spaces in the file_name variable | |
Re: Record truncation? Not normal behavior unless the record has embedded ascii nul characters. Lack of disk space or exceeding enabled quotas will also cause the output file to truncate. grep has a line length limit of 2048 characters. There also is a concept of largefiles, files which are so big … | |
Re: The short answer is "yes". If you give an example of the data then we can help you. |
The End.