Forum: C 19 Hours Ago |
| Replies: 3 Views: 107 You can pass the value to another function - and name the variable something else. But you are not gaining anything by doing that.
void refoo(int newname)
{
printf("variable newname=%d\n",... |
Forum: C Mar 21st, 2008 |
| Replies: 5 Views: 1,970 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,556 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,053 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: 7,137 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,747 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: 863 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,578 What code have you written so far? |
Forum: C Jun 2nd, 2007 |
| Replies: 1 Views: 2,545 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,337 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,222 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,445 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,287 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,609 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,316 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,505 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,505 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,828 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,609 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,324 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,465 sed 'n;s/$/;/' filename > newfilename |
Forum: Shell Scripting Jan 26th, 2007 |
| Replies: 3 Views: 2,104 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,252 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,156 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,156 It's telling you that you're referencing NULL pointers. |
Forum: Shell Scripting Jan 17th, 2007 |
| Replies: 3 Views: 3,284 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,971 Why loop? you only need two rsh lines. You gain nothing by looping. |
Forum: Shell Scripting Jan 4th, 2007 |
| Replies: 2 Views: 3,618 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,971 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,639 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,064 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,412 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,064 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,061 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,448 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,448 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,721 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: 928 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,380 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,949 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 {} \; |