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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)