152 Posted Topics
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: Note: files appear in a directory and can be ftp'ed even though another process is still writing to them. | |
Re: [code] echo $LOCATION | awk -F"_" '{print $2}' [/code] | |
Re: 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 … | |
Re: You are optimizaing this loop because you ran a profiler and too much time is being spent there, right? Otherwise DON'T optimize. | |
Re: 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 … | |
Re: 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 … | |
Re: [code] #!/bin/ksh if [ $# -eq 0 ]; then echo "$# is zero " else echo "$# is greater than zero" fi [/code] | |
Re: 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 | |
Re: 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, … | |
Re: 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. | |
Re: I'm sure it was homework. S/He should show what effort s/he made so far. | |
Re: 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. | |
Re: 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? | |
Re: 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. | |
Re: 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. | |
Re: 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. | |
Re: [url]www.physicsforums.com[/url] go to the homework forums - there is a calc section for textbook and homework problems. | |
Re: \\ in literal strings = \ because a single \ "escapes" the next character [code] "C:\\myfile\\hi.txt" [/code] | |
Re: [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 … | |
Re: 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 … | |
Re: 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] … | |
Re: 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 = … | |
Re: try awk. This is a start: [code] awk '{ for(i=1;i<=NF;i++) { if(length($i)<5) {print $i} } }' filename > newfilename [/code] | |
Re: 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 … | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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. … | |
Re: 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 … | |
Re: 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' | |
Re: 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. | |
Re: You need to look at expect rather than trying to use perl. expect is used for automating interactive dialogues. | |
Re: [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] | |
Re: 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. | |
Re: echo "some prompt" - displays a prompt read variablename - reads input from the terminal echo "$variablename" >> filename - appends a line Now you put them together. | |
Re: 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 … | |
Re: The OP wants the tries data structure. I don't know of any class that supports it. | |
Re: 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. … | |
Re: 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. | |
Re: 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] | |
Re: 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 … | |
Re: 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] | |
Re: 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. |
The End.