Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

files(3pub) [linux man page]

FILES(3pub)                                                    C Programmer's Manual                                                   FILES(3pub)

NAME
xgetaline, xfseek, xfopen, xfclose, getaline, fassert - file manipulation utilities SYNOPSIS
#include <files.h> FILE *xfopen(const char *filename, const char *mode); void xfclose(FILE *fp); void xfseek(FILE *fp, long offset, int origin); char *getaline(FILE *fp); char *xgetaline(FILE *fp); void fassert(FILE *fp); DESCRIPTION
These functions are useful for file manipulation. The functions that begin with x work like the functions without the letter, except if there is an error, they print an error message and kill the program. getaline reads a line from the given file. It allocates the memory for the line with malloc(3), and returns a pointer to the beginning of the line. If there is an error, it returns NULL. If the returned value is not NULL, the caller is responsible for freeing the memory. The newline is removed from the end of the line. fassert checks that the argument is not NULL, and that (for a non-NULL argument) the file does not have its error indicator flag set. If either condition is true, it prints an error message and termiantes the program. If neither condition is true, it does nothing. This can be used to add checks that the I/O in a program is going well; however, it is mostly useful only for small programs, because more serious programs need to handle the errors more gracefully. SEE ALSO
publib(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual FILES(3pub)

Check Out this Related Man Page

FILES(3pub)						       C Programmer's Manual						       FILES(3pub)

NAME
xgetaline, xfseek, xfopen, xfclose, getaline, fassert - file manipulation utilities SYNOPSIS
#include <files.h> FILE *xfopen(const char *filename, const char *mode); void xfclose(FILE *fp); void xfseek(FILE *fp, long offset, int origin); char *getaline(FILE *fp); char *xgetaline(FILE *fp); void fassert(FILE *fp); DESCRIPTION
These functions are useful for file manipulation. The functions that begin with x work like the functions without the letter, except if there is an error, they print an error message and kill the program. getaline reads a line from the given file. It allocates the memory for the line with malloc(3), and returns a pointer to the beginning of the line. If there is an error, it returns NULL. If the returned value is not NULL, the caller is responsible for freeing the memory. The newline is removed from the end of the line. fassert checks that the argument is not NULL, and that (for a non-NULL argument) the file does not have its error indicator flag set. If either condition is true, it prints an error message and termiantes the program. If neither condition is true, it does nothing. This can be used to add checks that the I/O in a program is going well; however, it is mostly useful only for small programs, because more serious programs need to handle the errors more gracefully. SEE ALSO
publib(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual FILES(3pub)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copying files with the latest date

Hi All, I have a situation where I need to copy the files having the latest date. For example I have a file by name bas100e1_jun05. I need to copy it to bas100e1. But when a file by name bas100e1_jul05 is put in the same directory the script should copy the file having the latest month which... (34 Replies)
Discussion started by: shashi_kiran_v
34 Replies

2. UNIX for Dummies Questions & Answers

Copy all the files with time stamp and remove header,trailer from file

All, I am new to unix and i have the following requirement. I have file(s) landing into input directory with timestamp, first i want to copy all these files into seperate directory then i want to rename these files without timestamp and also remove header,trailer from that file.. Could... (35 Replies)
Discussion started by: ksrams
35 Replies

3. Shell Programming and Scripting

Determining number of overlaps between two files using Hashes?

Hi there, I have a doubt about how to set this up. This is the situation. I have two files, one that is ~31,000 in length and has the following information (7 fields): file1 1 + 100208127 100261594 6 100208127,100231680,100237404,100245177,100249508,100260529, ... (35 Replies)
Discussion started by: labrazil
35 Replies

4. UNIX for Dummies Questions & Answers

combining two files

Hi Gurus, I have 2 files: File1 Filename1 xx Filename1 yy Filename1 Total Filename2 xx Filename2 yy Filename2 zz Filename2 Total Filename3 xx Filename3 Total and File2: Filename1 10296 xxx Date: 09/01/08 Filename2 10296 xxx Date: 09/05/08... (36 Replies)
Discussion started by: rock1
36 Replies

5. UNIX for Dummies Questions & Answers

How to find untagged audio files?

I've quite a collection audio files, mostly flac. In Rythmbox there are a files with no tags filled or filled with describing names as Track 01. I can look for properties to see which file it is and tag it with Easytag. But that quite time consuming. Is there a command line or a simple set of... (35 Replies)
Discussion started by: MrZehl
35 Replies

6. UNIX for Dummies Questions & Answers

List directories, subs and files

Hi, I try to list all files in a folder, including all the subdirs (and their subdirs) and all files contained in each of these folders. I then print it to a simple txt file. I use ls -R -1 >test.txt This sort of does what I need, yet, the result is something like: It reasonably comes... (53 Replies)
Discussion started by: dakke
53 Replies

7. UNIX for Dummies Questions & Answers

Getting non unique lines from concatenated files

Hi All, Is there a way to get NON unique lines from 2 or more concatenated files? Basically I have several files which are very similar with the exception of few lines and I want to find out which lines are different in each file. Very simple example is file1 contains: 1 2 3 4 5file2... (122 Replies)
Discussion started by: pawannoel
122 Replies

8. UNIX for Dummies Questions & Answers

How to pick only the latest files based on the timestamp?

I have a few log files which get generated on a daily basis..So, I need to pick only the ones which get generated for that particular day. -rw-r--r-- 1 staff 510732676 Apr 7 22:01 test.log040711 -rwxrwxrwx 1 staff 2147482545 Apr 7 21:30 test.log.2 -rwxrwxrwx 1 staff 2147482581 Apr 7 19:26... (43 Replies)
Discussion started by: win4luv
43 Replies

9. Shell Programming and Scripting

Need to delete large set of files (i.e) close to 100K from a directory based on the input file

Hi all, I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file. I have already prepared a list of files in the input file. Kndly help me. Thanks, Prash (36 Replies)
Discussion started by: prash358
36 Replies

10. Shell Programming and Scripting

Help me pls : splitting single file in unix into different files based on data

I have a file in unix with sample data as follows : -------------------------------------------------------------- -------------------------------------------------------------- {30001002|XXparameter|Layout|$ I want this file to be splitted into different files and corresponding to the sample... (54 Replies)
Discussion started by: Ravindra Swan
54 Replies

11. UNIX for Advanced & Expert Users

Help optimizing sort of large files

I'm doing a hobby project that has me sorting huge files with sort of monotonous keys. It's very slow -- the current file is about 300 GB and has been sorting for a day. I know that sort has this --batch-size and --buffer-size parameters, but I'd like a jump start if possible to limit the... (42 Replies)
Discussion started by: kogorman3
42 Replies

12. Shell Programming and Scripting

Need Time Stamp Range On Log Files

I have created this script #!/bin/sh FILES=/data/log/access_*.log for f in $FILES do echo "Processing $f file" cat $f | awk '{print $1}' | sort | uniq -c | sort -n | tail done It produces this output Processing /data/log/access_abc.log file 114 1.1.1.1 167 2.2.2.2 ... (38 Replies)
Discussion started by: sharingsunshine
38 Replies

13. Shell Programming and Scripting

Ranking data points from multiple files

I need to rank a large number of data points that exist in multiple files. My data points (Column 3) are based on unique values in columns 1 and 2. I need to rank the values that are in File 1, Column 3. For instance: Input File 1 AAA BBB 10 CCC DDD 16 EEE FFF 20 Input File 2 ... (47 Replies)
Discussion started by: ncwxpanther
47 Replies

14. UNIX for Beginners Questions & Answers

How Do I FTP System Files to Different Server?

Hello, I have a legacy system that is running on SCO OpenServer 5.0.6, and the hardware is becoming a little sketchy. I replaced the hard drive about a year ago, and was able to come back from a tape backup of my entire system. I have been successful with building a VM with VMware Workstation,... (42 Replies)
Discussion started by: spock9458
42 Replies

15. Shell Programming and Scripting

Split large xml into mutiple files and with header and footer in file

Split large xml into mutiple files and with header and footer in file tried below it splits unevenly and also i need help in adding header and footer command : csplit -s -k -f my_XML_split.xml extrfile.xml "/<Document>/" {1} sample xml <?xml version="1.0" encoding="UTF-8"?><Recipient>... (36 Replies)
Discussion started by: karthik
36 Replies