Search Results

Search: Posts Made By: pflynn
Forum: Programming 03-23-2012
3,637
Posted By pflynn
I would suggest you prefer strncat to strcat....
I would suggest you prefer strncat to strcat. strncat is the secure sister of strcat:



strncat - C++ Reference (http://www.cplusplus.com/reference/clibrary/cstring/strncat/)

usage of strncat...
12,791
Posted By pflynn
Well, I don't know how you can do this on the IBM...
Well, I don't know how you can do this on the IBM AIX, but since it's a commercial grade Unix system, I'm almost sure there is way you can do this. Unfortunately the solution to this problem is...
Forum: Programming 03-21-2012
2,660
Posted By pflynn
To the program work the way you expect, you need...
To the program work the way you expect, you need to initialize the str and str2 memory areas with the same values (say, with all zeroes, for example):


(...)
char str[20];
char str2[20];
...
Forum: Programming 01-05-2012
5,383
Posted By pflynn
You have options that range from opening...
You have options that range from opening directories and reading their contents manually ( opendir, readdir), searching for the files (and doing it recursively) to using more specific functions like...
Forum: Programming 12-21-2011
3,097
Posted By pflynn
If using the if bash keyword is not a must, you...
If using the if bash keyword is not a must, you could use the find program to do the job:


find . \( -name "*.dat" -o -name "*.asc" \) -exec rm {} \;


or


find . \( -name "*.dat" -o ...
Forum: Programming 12-18-2011
9,210
Posted By pflynn
I think you had better dynamically allocate the...
I think you had better dynamically allocate the memory to hold the string copy. A fixed length buffer is subject to buffer overflows. strdup(3) would do the work for you. Alternatively, you can use...
1,193
Posted By pflynn
You should quote the $username variable: ...
You should quote the $username variable:


user_id=`awk -v val="$username" -F: '$1==val{print $3}' /etc/passwd`
Forum: Programming 12-12-2011
9,183
Posted By pflynn
A process is running in the foreground if its...
A process is running in the foreground if its process group is the same as its terminal's foreground process group.


/*
To be complete and safe, you should open /dev/tty and pass the...
1,819
Posted By pflynn
Use the tee(1) program as suggested by yazu and...
Use the tee(1) program as suggested by yazu and put everything inside curly brackets if you have many commands:


{

echo hello
echo how are you?
echo i am fine

} | tee -a logfile.log

...
3,371
Posted By pflynn
arr[$1]=$3 What we are doing here is...
arr[$1]=$3


What we are doing here is creating an array, whose indexes are the contents of the first column of each line ("abc", "xyz", etc), and the values are the corresponding third element of...
3,371
Posted By pflynn
I think that the following would produce the...
I think that the following would produce the output you expect:


awk 'FILENAME == "A.txt" { arr[$1]=$3 } FILENAME == "B.txt" && arr[$1] != $3 { print $1 ,$3 - arr[$1] }' A.txt B.txt


What I...
Forum: Programming 04-11-2011
2,211
Posted By pflynn
The problem is that you can not initialize...
The problem is that you can not initialize members in a structure definition.
Showing results 1 to 12 of 12

 
All times are GMT -4. The time now is 11:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy