help with C programming (reading from files and printing them) (not C++)
I have a file called dvwl.c, and I am running it on a putty (unix server) using:
gcc -Wall -g -o mycode dvwl.c
./mycode 1 /usr/share/dict/words s
What it does is, it opens up words (since i gave that path) and reads the lines skipping the first line (since it says 1, if i put here 3, then it would skip the first 3 lines), then it is supposed to print the lines with all vowels removed (small or big, and not y/Y) and some other character as an argument (i put s for this). So it now print them with all vowels and s removed.
But I get these errors:
dvwl.c: In function âreplaceâ:
dvwl.c:5: warning: implicit declaration of function âtolowerâ
dvwl.c:6: warning: implicit declaration of function âtoupperâ
dvwl.c: In function âmainâ:
dvwl.c:15: error: âtryâ undeclared (first use in this function)
dvwl.c:15: error: (Each undeclared identifier is reported only once
dvwl.c:15: error: for each function it appears in.)
dvwl.c:15: error: expected â;â before â{â token
dvwl.c:31: warning: control reaches end of non-void function
What is wrong with my code? Also what is perror and how do I properly use it, and do i need an exit(1); after i use perror? Also what is wrong with my try/catch?
I've purchased few unix/linux programming books and also planning to buy couple of books in future. I've got the following books;
Advanced Unix Programming(2nd ed) -- M. Rochkind.
Advanced Programming on Unix Environment(3rd ed) -- Late Rick Stevens & Rago.
Unix Systems Programming -... (8 Replies)
Hi All,
Request your expertise in tackling one requirement in my project,(i dont have much expertise in Shell Scripting). The requirement is as below,
1) We store the last run date of a process in a file. When the batch run the next time, it should read this file, get the last run date from... (1 Reply)
HI All,
I have exactly 100 text files with extension .txt. The files contain numbers like this:
1.txt
0.4599994 65914
0.40706193 190743
0.39977244 185019
0.39831382 74906
0.3915928 122428
0.38844505 39999
0.38820446 72691
0.38787442 176430
0.38670844 28791
0.38597047 91091... (2 Replies)
hai
i have a directory lib
in that lib directory i have 10 batch files.
step i have to do is 1) EXECUTE ALL THE FILES by using the command dwarfdump <filename>| grep DW_AT_SUN_command_line
and put the output in one text file.instead of executing the files for all the 10 files... (13 Replies)
Hi Every body,
I have file which has enttries, with each 5 entries as a set of entries, I would like to read the file (line by line) and print five entries of a set vertically, the next entry should come in the next line.
Example:
cat sample_file
I am a
Unix Adminsitrator
new to shell... (6 Replies)
Hi,
I am dealing with strange problem...
whenever we use our software to trigger some printing files, along with that it generates lot of zero KB printing files, in our code base we generate a printing file only if its size is >0.
So I suspect it could be something to do with printing level... (2 Replies)
I have a file which has following contents:
localhost_IP_SIP_1233026552455.xml
localhost_IP_SIP_1233026552460.xml
localhost_IP_SIP_1233026552467.xml
localhost_IP_SIP_1233026552759.xml
localhost_IP_SIP_1233026552969.xml
localhost_IP_SIP_1233026552975.xml ... (2 Replies)
Hello,
I have two files:
file1
1
2
3
4
5
file2
"a","b",,,,,"c","1",.....
"s","d",,,,,"s","1",.....
"a","c",,,,,"d","1",....
"f","v",,,,,,"f","2",.....
etc
I have to read "1" from file1 and grab all records in file2 (say column 6 in file2 is "1") until the column changes its value (... (6 Replies)
Hi all:
I'm trying to resolve a print issue in HPUX.
Background:
An ascii report file was being produced by a program. It was being sent to the printer via internal commands, to wit:
let #send_status = 0
let $send_cmd = 'lp -d lp03 /ps/tmp/edsprint/eds*.N.LIS'
call... (4 Replies)
Please forgive my ignorance...but I was hoping a Unix guru could help me with sending .TIFF files to an HP color laserjet 8550. I understand that .TIFF is not one of the languages used in this case, but I understood that there might be some commands that could be added to the queue to allow it to... (3 Replies)