152 Posted Topics

Member Avatar for massoo

Your script is tough to read - for me at least. I don't see basic things like exec, closing stdin, stdout, etc. Try reading this see if it makes sense in the context of your shell script. In general, it is possible to have a script "daemonized", but you have …

Member Avatar for radix
0
250
Member Avatar for taniyadas

Interpreted? write() calls are deferred to some future time by the kernel. However, any read() to that file after a write is guaranteed to be able to read the data written. This means that if the kernel panics just when a deferred write() call retruns, the data will be lost …

Member Avatar for jim mcnamara
0
95
Member Avatar for Aldin

This is a simple-minded C version. You can use strtok in C++ as well. [code] #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXFLDS 200 /* maximum possible number of fields */ #define MAXFLDSIZE 32 /* longest possible field + 1 = 31 byte field */ void parse( char *record, char …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for neko128

Note: files appear in a directory and can be ftp'ed even though another process is still writing to them.

Member Avatar for alc6379
0
118
Member Avatar for bhavana
Member Avatar for djbsabkcb

[code] SQL> col brackets format a7 trunc SQL> select '[ ]' brackets, my_field1 from mytable; BRACKET MY_FIELD1 ------- --------------- [ ] JOHN SMITH [/code]

Member Avatar for jim mcnamara
0
95
Member Avatar for sameet_aset

Hardcoded passwords are a security risk - FWIW. if you are root you can use sudo or su by default. Otherwise use a here document: [code] su username <<! password /bin/ksh command command command exit ! [/code] su may also give you the wrong shell, which is why I put …

Member Avatar for alc6379
0
165
Member Avatar for rasheed1982

You are optimizaing this loop because you ran a profiler and too much time is being spent there, right? Otherwise DON'T optimize.

Member Avatar for Ancient Dragon
0
138
Member Avatar for khot_anuradha

FWIW - opening an MS-DOS text file (FAT16) in binary mode doesn't necessarily work as described above. The reason is that the reported size of the file by the filesystem is not the same as the length of the data in the file - because text files in MS-DOS end …

Member Avatar for agiorgio
0
368
Member Avatar for crusty_collins

try [code] status = tibrvTransport_Create(transport, serviceStr, networkStr, daemonStr); [/code] transport is already a pointer, so using *transport says to pass that value of the object pointed to, not the address. Pointers are addresses. It also seems you are not prototyping functions. Or maybe not including header files. There should be …

Member Avatar for crusty_collins
0
111
Member Avatar for Prestwick

[code] #!/bin/ksh if [ $# -eq 0 ]; then echo "$# is zero " else echo "$# is greater than zero" fi [/code]

Member Avatar for Prestwick
0
204
Member Avatar for Subterraneus

If your commands produce output consider using popen() which works like somewhat system() but allows one-way communication between the shell and the C program. system() does'nt do that. man popen

Member Avatar for Subterraneus
0
154
Member Avatar for Kiba Ookami

Ok. Game development is complex. There are lots of positions. Usually QA is the easiest place to start. Graphics programmers work on the game engine itself. There may be several game engine teams - one for Windows, One for XBOX. Depending on the platform, development is usally in C++, C, …

Member Avatar for gtsincorp
0
272
Member Avatar for tristan17

It means that the dirlog variable contains a string literal value. The value is randomdir.log The other two statements are attempting to: 1. to append (add-on to the end of) a file 2. read from a file On failure they print messages and then exit.

Member Avatar for tristan17
0
97
Member Avatar for adil_uk
Member Avatar for atanu_amd
0
119
Member Avatar for MikeDirnt

And. You have to source the script. It may or may not run in a subshell (another process) with [code] [b].[/b] myfscript.sh [/code] note the leading dot - in linux there is the source command in bash which does the same thing.

Member Avatar for jim mcnamara
0
181
Member Avatar for diddle

You need to give us exactly what you are doing. Your expected input, expected output. The code as written will trash every file it works on except that last one, ie. dozens of files may become newname. How do you want the new name to be?

Member Avatar for diddle
0
111
Member Avatar for carabs

If the box in question a unix box, try setting up a signal handler - with use sigtrap alarm() is supposed to send a SIGALRM to the process, which by default terminates. Unless another handler (trap statement) is active This does not work in Windows.

Member Avatar for jim mcnamara
0
117
Member Avatar for javier_ccs

Let's start here: [code] expect firewall.exp > javier-$(date +%d%b%Y).txt [/code] should be: [code] expect firewall.exp >> javier-$(date +%d%b%Y).txt [/code] I'm not clear about the ip thing at the moment, this part should work for you.

Member Avatar for javier_ccs
0
130
Member Avatar for trinath

Dave - I actually made the mistake of giving him working Pro*C code - another forum. He did not seem to get that it worked. But it wasn't exactly what he specified, because his requirements are non-sequitur in a production world. It's probably a weird homework assignment.

Member Avatar for jim mcnamara
0
121
Member Avatar for hruzam

[url]www.physicsforums.com[/url] go to the homework forums - there is a calc section for textbook and homework problems.

Member Avatar for hruzam
0
377
Member Avatar for masa

\\ in literal strings = \ because a single \ "escapes" the next character [code] "C:\\myfile\\hi.txt" [/code]

Member Avatar for masa
0
97
Member Avatar for skulkarni

[code] #!/bin/ksh ls /home/FTPXFER/$1 [/code] finds files in the /home/FTPXFER path. The example below was run with the current working directory set to /home/jmcnama usage: [code]test.sh '*'[/code] output: [code] /home/FTPXFER/UX1006 /home/FTPXFER/curocfix /home/FTPXFER/premd_0404 /home/FTPXFER/UX1617 /home/FTPXFER/curocsbp /home/FTPXFER/premd_04_11 /home/FTPXFER/UXDEV3a /home/FTPXFER/curocsfix /home/FTPXFER/premd_04_12 /home/FTPXFER/UXURR /home/FTPXFER/custd_04_12 /home/FTPXFER/premd_04_19 /home/FTPXFER/UZBBMSG.DAT /home/FTPXFER/custd_04_19 /home/FTPXFER/premd_04_22 /home/FTPXFER/UZBMSGT.DAT /home/FTPXFER/custd_04_22 /home/FTPXFER/premd_04_25 /home/FTPXFER/UZBSRAT.DAT /home/FTPXFER/custd_04_25 /home/FTPXFER/premd_0525 …

Member Avatar for jim mcnamara
0
174
Member Avatar for desertstorm

This looks like MS code. If that's the case try [url]www.msdn.microsoft.com[/url] OpenFileId is a file handle created by open. int is the size of the buffer you want to read buf is the address of the buffer Read returns (-1 or possibly zero) for a variety of reasons, including being …

Member Avatar for jim mcnamara
0
131
Member Avatar for Mistro116

After a ver quick look, I think that you overwrote a pointer - having it point to a bogus address. malloc works (It's called Doug Lea malloc which is the basis for many versions of malloc) kinda like this: [code] typedef union { ptrdiff_t malloc_size; void *ptr; } malloc_t; [/code] …

Member Avatar for Mistro116
0
105
Member Avatar for C++ programer

It's not clear to me what you want. But here is very basic code for structs. [code] struct Household { int Noperson; char letters[20]; double income; }; /* find the maximum income */ struct Household *foo(struct Household *src, int cnt) { struct Household *p=src; struct Household *retval=src; double max = …

Member Avatar for jim mcnamara
0
138
Member Avatar for darklord

try awk. This is a start: [code] awk '{ for(i=1;i<=NF;i++) { if(length($i)<5) {print $i} } }' filename > newfilename [/code]

Member Avatar for jim mcnamara
0
156
Member Avatar for pixiee73

Try some local contract work. Or take on a pro-Bono project for Salvation Army or something. Startup companies are far more likely to hire you as well. The reason things are like this is because the companies who view IT more as an expense than a resource (the same ones …

Member Avatar for pixiee73
0
152
Member Avatar for djbsabkcb

Your specifications are kinda fuzzy - I used PL/SQL to get what I thought you wanted - one weeks worth of data. The &1 thing is for interactive input. If you saved this as "someday.sql" then usage in sqlplus would be [code]@someday 01-NOV-2005[/code] [code] SET SERVEROUT ON SIZE 1000000 spool …

Member Avatar for jim mcnamara
0
98
Member Avatar for SNA

This is a QA kind of question. You should feed your alogorithm data which has: 1. values outside given bounds, like what the sqrt() runtime function does: It is able able to return NaN or +INFINITY and sets errno=EDOM (unix only). 2. validate output for known value sets, with extremely …

Member Avatar for perniciosus
0
185
Member Avatar for mrnath

Chris is right - the answer is totally language dependent. In general there no functions like that in most high level languages, some databases provide that capability, as do a few specialy languages. Normally you write a small function/procedure to do it.

Member Avatar for jim mcnamara
0
77
Member Avatar for Manojsah

If you're an advanced CS student asking this question, find another final project. You're going to have trouble. Otherwise, consider looking at what other people have done before. First off, you should have read at least one advanced Unix programming book - like Richard Steven's book. I know you haven't …

Member Avatar for Manojsah
0
128
Member Avatar for winbatch

Yes. - it's called a static link. It means that all of the runtime you need is part of the image file - obviously a much bigger image file. I can't tell which version of unix you have, but your man ld page will tell you how to do that. …

Member Avatar for winbatch
0
243
Member Avatar for djbsabkcb

Using Oracle and the SQL langauge are somewhat different things. Oracle has a lot of "features" like Oracle Forms and PL/SQL that are Oracle-specific. Oracle comes with a learning "set" -- the scott/tiger schema. Most books that teach about Oracle and SQL assume you already have the "EMP" table for …

Member Avatar for jim mcnamara
0
99
Member Avatar for tukai
Member Avatar for matt_5104

Get yourself a CEH, Narue. It's worth the effort (Security Testing Certification - Certified Ethical Hacker, not kidding). See Jack Koziol's 'Shellcoder's Handbook'

Member Avatar for jim mcnamara
0
134
Member Avatar for snaidis

factorials get BIG really fast and exceed the limits of 32-bit unsigned integer variables by 13!. If you want to play with them use a datatype that can handle huge numbers, or switch to an extended precision mathematics library like GMP.

Member Avatar for Narue
0
377
Member Avatar for eachowcc

You need to look at expect rather than trying to use perl. expect is used for automating interactive dialogues.

Member Avatar for Comatose
0
316
Member Avatar for comwizz

[code] This file: #include <math.h> int main(int argc, char *argv[]) { printf("%f\n",pow(2., 3.5) ); return 0; } compiled this way (This is unix does not matter) kcsdev:/home/jmcnama> cc t.c -lm Gives this result: kcsdev:/home/jmcnama> a.out 11.313708 [/code]

Member Avatar for jim mcnamara
0
374
Member Avatar for Zababa

This works: [code] int main(int argc, char *argv[]) { char table[5][10]={"Hello","Hello","Hello","Hello","Hello"}; int i=0; for(i=0;i<5;i++) { printf("%d %s\n",i,table[i]); } return 0; } [/code] Also, don't compile C under a C++ compiler, if you can avoid it, you will get some odd results.

Member Avatar for jim mcnamara
0
415
Member Avatar for egoleo
Member Avatar for Wolfy

echo "some prompt" - displays a prompt read variablename - reads input from the terminal echo "$variablename" >> filename - appends a line Now you put them together.

Member Avatar for jim mcnamara
0
102
Member Avatar for johnray31

Whenever you compile C code you should enable warnings. Some compilers will not complain unless you tell them to complain. What compiler are you using? Is it an ancient version of BORLAND C++ or TURBO C? You really need to use a modern compiler - there are free ones on …

Member Avatar for johnray31
0
453
Member Avatar for nisaa15

The OP wants the tries data structure. I don't know of any class that supports it.

Member Avatar for jim mcnamara
0
210
Member Avatar for altheastronut

The awk internal variable NR tells you what line you are currently working on [code] awk 'NR > 4 && NR < 11' filename [/code] O'Reilly book 'sed & awk' - the one with the the tarsiers on the front cover. If you're going to use awk get that book. …

Member Avatar for jim mcnamara
0
176
Member Avatar for vicky_dev

This is a Windows problem - Windows has an answer: The MoveFile API allows you to defer the action until reboot, so you can move the file to NULL: or wherever. The MOVEFILE_DELAY_UNTIL_REBOOT - flag is specifically meant for files like dll's and pagefiles that remain open all the time.

Member Avatar for WolfPack
0
221
Member Avatar for gal

try: [code] #!/bin/ksh # this works under ksh # assume TEMP2 TEMP3 TEMP4 are defined more $TEMP2 | grep join | awk '{print $3}' > $TEMP3 while read group do { LENGTH=${#group} LENGTH=$(($LENGTH-2)) echo $group > $TEMP0 cut -c8-$LENGTH $TEMP0 >>$TEMP4 } done < $TEMP3 [/code]

Member Avatar for jim mcnamara
0
70
Member Avatar for raj_thota

Assuming I understand your problem: [code] find /path1 -exec basename {} \; | sort > file1 find /path2 -exec basename {} \; | sort > file2 # at this point you can use diff file1 file2 # or # here we want files only listed in file1 but not in …

Member Avatar for jim mcnamara
0
419
Member Avatar for alex05

This awk one-liner works pretty well - [code] awk '!x[$0]++' file.old > file.new [/code] This checks the whole line This one just checks for part of the line in this case the first 16 characters. [code] awk '!x[substr($0,1,16)]++' file.old > file.new [/code]

Member Avatar for jim mcnamara
0
333
Member Avatar for Yokonomo

It is IT management and possibly some system admin or maybe DBA stuff - infrastructure support in general. Software development and maintenance are sort of tangential to your field of study. In terms of jobs, your area is not as likely to go overseas.

Member Avatar for jim mcnamara
0
255

The End.