READ(2) System Calls Manual READ(2)NAME
read - read from file
SYNOPSIS
read(fildes, buffer, nbytes)
char *buffer;
DESCRIPTION
A file descriptor is a word returned from a successful open, creat, dup, or pipe call. Buffer is the location of nbytes contiguous bytes
into which the input will be placed. It is not guaranteed that all nbytes bytes will be read; for example if the file refers to a type-
writer at most one line will be returned. In any event the number of characters read is returned.
If the returned value is 0, then end-of-file has been reached.
SEE ALSO open(2), creat(2), dup(2), pipe(2)DIAGNOSTICS
As mentioned, 0 is returned when the end of the file has been reached. If the read was otherwise unsuccessful the return value is -1.
Many conditions can generate an error: physical I/O errors, bad buffer address, preposterous nbytes, file descriptor not that of an input
file.
ASSEMBLER
(read = 3.)
(file descriptor in r0)
sys read; buffer; nbytes
(byte count in r0)
READ(2)
Check Out this Related Man Page
READ(2) System Calls Manual READ(2)NAME
read, readn, write - read or write file
SYNOPSIS
#include <u.h>
#include <libc.h>
long read(int fd, void *buf, long nbytes)
long readn(int fd, void *buf, long nbytes)
long write(int fd, void *buf, long nbytes)
DESCRIPTION
Read reads nbytes bytes of data from the offset in the file associated with fd into memory at buf. The offset is advanced by the number of
bytes read. It is not guaranteed that all nbytes bytes will be read; for example if the file refers to the console, at most one line will
be returned. In any event the number of characters read is returned. A return value of 0 is conventionally interpreted as end of file.
Readn is just like read, but does successive read calls until nbytes have been read, or a read system call returns a non-positive count.
Write writes nbytes bytes of data starting at buf to the file associated with fd at the file offset. The offset is advanced by the number
of bytes written. The number of characters actually written is returned. It should be regarded as an error if this is not the same as
requested.
SOURCE
/sys/src/libc/9syscall
/sys/src/libc/port/readn.c
SEE ALSO intro(2), open(2), dup(2), pipe(2)DIAGNOSTICS
These functions set errstr.
READ(2)
Hi,
I have grep:ed on a file with which gives the below output.
Total = 43
Total = 21
Total = 23
Total = 2
Total = 3
Total = 1
Total = 0
I would like to add the first 4th lines to a total amount, and do so on for the rest of the lines.
I was thinking in terms of using while read.... (32 Replies)
Hiii
I am very new to shell scripting.This is my data file
a.txt:
56
45.78
1000
11.23
76.89
45
34.56
23
3400
100
..........
Now i am must use shell scripting to read n number of lines from the file & from ts n number of lines i need to find greatest number among them & so on for... (44 Replies)
Hi,
I have a simulation program which creates two threads and I would like to know if I can measure the time of each individual thread. Threads communicate (I use pthread to manage them) and I want to measure communication time. I found a solution with clock_gettime and CLOCK_THREAD_CPUTIME_ID... (32 Replies)
Friends,
This is what I need:
I will pass a CSV file as an input, and I want my shell to be reading that CSV file, and based on the parameters it should generate SQLs and write those SQL in a different file in the same location.
I'm new to Shell scripting. I'm currently working on a... (25 Replies)
how to run an already developed script run against a list of ip addresses solaris 8 question.
the script goes away and check traffic information, for example
check_GE-VLANStats-P3 1.1.1.1
and returns the results ok.
how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
I am reading a value from a file and want to store the value in a dynamic array as i don't know the number of occurrences of the value in that file.
How can i do that and then later fetch that value from array (25 Replies)
hi
i need to extract lines from multiple files to a csv file.
for example, i have these 3 files
file1.txt
date:29dec1980
caller:91245824255
called:8127766
file2.txt
date:11apr2014
caller:9155584558
called:8115478
file3.txt
date:25jun2015
caller:445225552
called:8117485 (30 Replies)
Hi guys,
I'm sorry but i badly need your help. I am assigned to do a basic shell script in my job but sadly i don't have any idea on what it is because i am an electronics engineer, but i googled all of it, ask my friends but i cant finalize my scripts. so do please help me.
The requirement... (47 Replies)
Instead of the slow and not readable tooltips with the preview of the thread content in forum view, I have added the preview with mouseover (see attached movie).
Let me know if you want a different kind of preview (animation, duration font-color, size, etc,)
Thanks.
<script>... (29 Replies)
Finally making some progress on getting rid of the 10 year old buttons with modern day fonts and icons thanks to a responsive web design tutorial by Brad Traversy who's video pointed me to Font Awesome.
The buttons and icons were pretty easy to implement but it too me a number of hours... (39 Replies)