Forum: C Dec 17th, 2006 |
| Replies: 13 Views: 7,297 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: C Dec 12th, 2006 |
| Replies: 2 Views: 941 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,457 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: C Oct 31st, 2006 |
| Replies: 2 Views: 896 Wow.
void main() - don't use void main. main() returns an int.
{
clrscr();
while(i--!=6) - where is i set to some intitial value?
i=i+2; - this is the end of the... |
Forum: C Sep 18th, 2006 |
| Replies: 5 Views: 1,596 HPUX supports alloca() -
it has advantages and disadvantages
good - it automatically frees all objects created by alloca calls when
the function making those calls exits
good - it is... |
Forum: Shell Scripting Sep 15th, 2006 |
| Replies: 6 Views: 6,025 I changed it so awk puts it all on the same line. |
Forum: Shell Scripting Sep 12th, 2006 |
| Replies: 6 Views: 6,025 I'd use arrays:
#!/bin/ksh
optfile=filename
set -A opts $(awk 'BEGIN {FS="="} { if($0~ / page_size/) { print $2}}' $optfile)
for i in 0 1 2
do
echo ${opts[i]}
done |
Forum: Shell Scripting Sep 11th, 2006 |
| Replies: 9 Views: 7,186 #!/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... |
Forum: Shell Scripting Sep 8th, 2006 |
| Replies: 4 Views: 1,744 In that case you have to use cp. mv does not mv over mount points. |
Forum: C Sep 8th, 2006 |
| Replies: 5 Views: 4,904 cat /proc/meminfo
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... |
Forum: C++ Sep 6th, 2006 |
| Replies: 7 Views: 10,989 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... |
Forum: C Aug 4th, 2006 |
| Replies: 7 Views: 1,737 You are not calling strtok correctly.
try something like this:
void foo(char *string1, char *string2)
{
char *first=strtok(string1,"|");
char *second=string2(string2,"|");... |
Forum: Shell Scripting Aug 3rd, 2006 |
| Replies: 2 Views: 2,431 Your logic doesn't make any sense to me...
You want to get to the "got it" statement - this does it.
#!bin/ksh
a=5
while [[ $a -gt 5 ]]
do
echo "a=5 and not went to else cdn." |
Forum: Shell Scripting Jun 29th, 2006 |
| Replies: 5 Views: 8,975 Here is a start - you need to read up on shell scripting
#!/bin/ksh
# function gen_data
# record performance data, place in a file with each node's
# information all on one line... |