Forum: C Mar 21st, 2008 |
| Replies: 5 Views: 1,934 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 -... |
Forum: C Feb 4th, 2008 |
| Replies: 3 Views: 5,432 It sounds like you are coding UNIX. From the man page for system:
Generally, that would be WEXITSTATUS(system("./myscript") );
Try: man 2 wait or info wait. |
Forum: Shell Scripting Jan 10th, 2008 |
| Replies: 3 Views: 2,040 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... |
Forum: C Jul 9th, 2007 |
| Replies: 3 Views: 6,999 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. ... |
Forum: Shell Scripting Jun 25th, 2007 |
| Replies: 4 Views: 1,741 http://www.freebsd.org/cgi/man.cgi?query=sysexits&apropos=0&sektion=0&manpath=FreeBSD+4.3-RELEASE&format=html |
Forum: C Jun 19th, 2007 |
| Replies: 4 Views: 851 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. |
Forum: C Jun 2nd, 2007 |
| Replies: 7 Views: 1,552 What code have you written so far? |
Forum: C Jun 2nd, 2007 |
| Replies: 1 Views: 2,467 Short answer would be to have a while loop controlled by the totalinsert and money variables
while( totalinsert < money)
{
/* ask for money here, add it to total insert */
}
/* you get... |
Forum: Shell Scripting May 29th, 2007 |
| Replies: 2 Views: 1,329 for i in $(cut -f 1,3 -d: /etc/passwd)
do
echo "${i#*:}" "${i%:*}"
done
This lets you see what is going on. ${i#*:} is parameter substitution- returns the value just before the colon -... |
Forum: C May 22nd, 2007 |
| Replies: 2 Views: 2,196 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... |
Forum: C May 16th, 2007 |
| Replies: 23 Views: 13,239 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, ... |
Forum: Shell Scripting May 8th, 2007 |
| Replies: 1 Views: 1,273 try:
#!/bin/ksh
export infile=filename
filedate()
{
perl -e '
use Time::Local;
$mytime = timelocal(0,$ARGV[4],$ARGV[3],$ARGV[1], |
Forum: C++ Mar 16th, 2007 |
| Replies: 2 Views: 1,580 C version: returns pi/4
#include <stdlib.h>
double pi_over_4(int n)
{
double iter=3;
int eveodd=1;
double pi=0.; |
Forum: C Mar 13th, 2007 |
| Replies: 6 Views: 1,308 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... |
Forum: C Mar 9th, 2007 |
| Replies: 9 Views: 7,381 You did not explain your full data design. So the answer as to why 5 million hash tables =
one hash for one array.
Explain how you need to lookup values in each array. It would help. It... |
Forum: C Mar 9th, 2007 |
| Replies: 9 Views: 7,381 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... |
Forum: Shell Scripting Mar 6th, 2007 |
| Replies: 4 Views: 1,817 You have to use either ksh (zsh) or bash to do this - ie., a modern shell with pattern matching.
cd /path/to/files
find . -name '*.err' |\
while read file
do
tmp=${file%%.das*}
mv $file... |
Forum: C Feb 19th, 2007 |
| Replies: 2 Views: 2,569 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... |
Forum: Shell Scripting Feb 13th, 2007 |
| Replies: 1 Views: 1,323 try:
#
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$'... |
Forum: Shell Scripting Jan 26th, 2007 |
| Replies: 3 Views: 4,447 sed 'n;s/$/;/' filename > newfilename |
Forum: Shell Scripting Jan 26th, 2007 |
| Replies: 3 Views: 2,087 You need to use sed, and you have to learn about regular expressions.
based on your data a very specific (not generalized) solution is:
$> echo "Here's some text and ~this bit gets removed~,... |
Forum: Shell Scripting Jan 26th, 2007 |
| Replies: 1 Views: 2,234 This will generate a report like you asked for.
nawk '
{ shortcode[$11]=$11
causecode[$12]=$12
result[$11 $12]++
}
END{ for( short in shortcode)
{... |
Forum: C++ Jan 18th, 2007 |
| Replies: 5 Views: 2,130 I guess I should add:
stdc allows the use of memcpy with the arguments you stated. What the compiler calls as its own version of run-time memcpy can have any number of aguments. A lot of the API... |
Forum: C++ Jan 18th, 2007 |
| Replies: 5 Views: 2,130 It's telling you that you're referencing NULL pointers. |
Forum: Shell Scripting Jan 17th, 2007 |
| Replies: 3 Views: 3,260 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... |
Forum: Shell Scripting Jan 5th, 2007 |
| Replies: 4 Views: 4,907 Why loop? you only need two rsh lines. You gain nothing by looping. |
Forum: Shell Scripting Jan 4th, 2007 |
| Replies: 2 Views: 3,608 script:
# $1 = path to examine
# usage
# myscript /path
find "$1" -type d -print |\
while read file
do
permissions=$(ls -l $file | awk '{print $1}') |
Forum: Shell Scripting Jan 4th, 2007 |
| Replies: 4 Views: 4,907 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
For "rsh" do you mean rexec or remsh? Or... |
Forum: C Dec 19th, 2006 |
| Replies: 5 Views: 1,631 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... |
Forum: C Dec 18th, 2006 |
| Replies: 13 Views: 7,013 linux is unix.
It doesn't work in cygwin, however - a linux emulation that runs under windows and calls the Windows API for time stuff.
If for some reason TZ is not set for your login process... |
Forum: Shell Scripting Dec 18th, 2006 |
| Replies: 1 Views: 5,353 su or sudo
Read the man page for su.
Both of these require superuser (root) access. |
Forum: C Dec 17th, 2006 |
| Replies: 13 Views: 7,013 UNIX only:
getenv("TZ");
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.... |
Forum: Shell Scripting Dec 17th, 2006 |
| Replies: 1 Views: 2,053 The short answer is "yes". If you give an example of the data then we can help you. |
Forum: Shell Scripting Dec 14th, 2006 |
| Replies: 4 Views: 4,383 The way disk i/o in unix works is that data is parked in an in-memory cache in the kernel - it is not guaranteed to be written to disk when the write() system call is invoked. Every 30 seconds or... |
Forum: Shell Scripting Dec 13th, 2006 |
| Replies: 4 Views: 4,383 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... |
Forum: Shell Scripting Dec 13th, 2006 |
| Replies: 4 Views: 3,675 file_name=`echo "$file_name" | sed 's/ //g'`
That removes any spaces in the file_name variable |
Forum: C Dec 12th, 2006 |
| Replies: 2 Views: 923 What normally is done (assuming that only one of the code pieces has a main() ) is to compile each of the sourcefiles into a separate object file and then link them all into one program.
To... |
Forum: C Dec 12th, 2006 |
| Replies: 7 Views: 2,363 This is allowable C, but can cause you problems if you are not super careful - meaning: it will cause problems. But it does answer your question.
#include <string.h>
int myfunc(const char *a,... |
Forum: Shell Scripting Nov 30th, 2006 |
| Replies: 1 Views: 4,918 find does date comparisons for you.
Example - this code deletes files older than 48 hours (2 days):
find /home/julie/trash -type f -mtime +2 -exec rm -f {} \; |
Forum: Shell Scripting Nov 26th, 2006 |
| Replies: 1 Views: 1,748 myvar="Hi there"
backwards=`echo "$myvar" | rev`
echo "$backwards" |