Sponsored Content
Full Discussion: read/write files
Top Forums Programming read/write files Post 302370514 by Attenea on Wednesday 11th of November 2009 04:59:18 PM
Old 11-11-2009
read/write files

Hi all,

I have a problem with some read/write functions.
I have a .bin file which contains a lot of structures as follows:

Code:
struct alumno
{
char id[10]; 
char apellido1[32];
char apellido2[32];
char nombre[32];
float nota1p; 
float nota2p; 
float notamedia; 
char photofilename[20]; 

};

What I have to do is read the file, firstly one structure by one, and then all the file at once and change the value if notamedia is less than 3. I'm using read() and lseek(), but I'm very loss Smilie. Somebody can give me a hand in developing the code. I believe is not too big.
Thanks in advance for the help

Last edited by pludi; 11-12-2009 at 04:43 AM.. Reason: code tags, please...
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to read and write files one line at a time.

Hi! All! I am wirting a shell script in which i want to read one line at a time from the file and write it simultaneouly to other file one line at a time. Please let me know about some shell utility which can help me out. Thanx. If further clarifications are needed then please let me know... (2 Replies)
Discussion started by: s_chopra
2 Replies

2. Shell Programming and Scripting

Script with read/write Files

Hello, I am a Newbie in ksh Unix Script. So I must write a ksh/sh script who read character at a position in a File. So also it must read all the lines who belongs at these characters , then write these lines in a another File. Can you help me , or give little councils to advance with my... (5 Replies)
Discussion started by: steiner
5 Replies

3. UNIX for Dummies Questions & Answers

how to read or write device files

hi everybody, i am working in device drivers.As a beginner to this field ,i dont know how to read or write device files. Will copy_to_user and copy_from_user help me? I have created a device file using mknod command .Can anybody help me in this regard :confused thanks in advance sriram (1 Reply)
Discussion started by: sriram.ec
1 Replies

4. Shell Programming and Scripting

SED command for read and write to different files

Hi I need some help on SED command I am writing a shell script which does the following: 1. Read one line at a time from a file abc.txt which has millions of lines 2. Prefix each line read with some text " 3. Post fix each line read with a quote " 4. Write the new modified... (11 Replies)
Discussion started by: gaurav_1711
11 Replies

5. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

6. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

7. Shell Programming and Scripting

How to read and write last modified timestamp to files?

Need help reading file last modified date in format: Filename (relative path);YYYYMMDDHHMMSS And then write it back. My idea is to backup it to a text file to restore later. Checked this command but does not work: Getting the Last Modification Timestamp of a File with Stat $ stat -f... (5 Replies)
Discussion started by: Tribe
5 Replies

8. Shell Programming and Scripting

Read input files and merge them in given order and write them to input one param or one file

Dear Friends, I am looking for a shell script to merge input files into one file .. here is my idea: 1st paramter would be outfile file (all input files content) read all input files and merge them to input param 1 ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies

9. Shell Programming and Scripting

Read and write operations on files.

Dears. kindly guide !!! I have data, which is delimited by | . it should contain 26 columns, but one column data contain | makes few row to 27 columns. I want to find rows have 27 columns and then concatenate the specific columns to single column to make it 26 columns. Kindly help, Can... (3 Replies)
Discussion started by: sadique.manzar
3 Replies
sin(3m) 																   sin(3m)

Name
       sin, cos, tan, asin, acos, atan, atan2 - trigonometric functions and their inverses

Syntax
       #include <math.h>

       double sin(x)
       double x;

       float fsin(x)
       float x;

       double cos(x)
       double x;

       float fcos(x)
       float x;

       double tan(x)
       double x;

       float ftan(x)
       float x;

       double asin(x)
       double x;

       float fasin(x)
       float x;

       double acos(x)
       double x;

       float facos(x)
       float x;

       double atan(x)
       double x;

       float fatan(x)
       float x;

       double atan2(y,x)
       double y,x;

       float fatan2(y,x)
       float y,x;

Description
       The and functions return trigonometric functions of radian arguments x for double data types.

       The and functions return trigonometric functions for float data types.

       The and functions return the arc sine in the range -pi/2 to pi/2 for double and float data types, respectively.

       The and functions return the arc cosine in the range 0 to pi for double and float data types, respectively.

       The and functions return the arc tangent in the range -pi/2 to pi/2 for double and float data types, respectively.

       The  and  functions  return  the  arc tangent of y/x in the range -pi to using the signs of both arguments to determine the quadrant of the
       return value for double and float data types, respectively.

   Error (due to roundoff)
       When P stands for the number stored in the computer in place of pi = 3.14159 26535 89793 23846 26433 ... .  and "trig" stands  for  one	of
       "sin",  "cos"  or  "tan",  then	the  expression  "trig(x)" in a program actually produces an approximation to trig(x*pi/P), and "atrig(x)"
       approximates (P/pi)*atrig(x).  The approximations are close.

       P differs from pi by a fraction of an ulp; the difference is apparent only if the argument x is huge,  and  even  then  the  difference	is
       likely  to  be swamped by the uncertainty in x.	Every trigonometric identity that does not involve pi explicitly is satisfied equally well
       regardless of whether P = pi.  For example, sin(x)**2+cos(x)**2 = 1 and sin(2x) = 2sin(x)cos(x) to within a few ulps regardless of how  big
       x is.  Therefore, the difference between P and pi is unlikely to effect scientific and engineering computations.

Return Values
       All the double functions return NaN if NaN is passed in.

       If |x| > 1 then (x) and (x) will return the default quiet NaN.

       The function defines (0,0) = NaN.

See Also
       hypot(3m), math(3m), sqrt(3m)

								       RISC								   sin(3m)
All times are GMT -4. The time now is 10:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy