Sponsored Content
Top Forums UNIX for Advanced & Expert Users Problem while writing to a file...? Post 302289953 by vijay4b7 on Friday 20th of February 2009 10:38:50 PM
Old 02-20-2009
Thank you for your reply...Yes, I'm using Fedora9 linux....and writing the program in C language....

My requirement is that both the users must able to write the data in to the file...

But how to know that another user has opened the file in write mode...So that 2nd user,mean while writes his data in to buffer and once the 1st user completes his writing, the data has to be placed into the file...

Will lsof() func helps?
 

10 More Discussions You Might Find Interesting

1. HP-UX

Problem in HP-Unix while writing into socket

Our system is having a server and multiple clients. We are monitoring the client FDs using select() system call in HP-UX. After establishing connection-using socket with the remote client, before start sending the data we are checking the status of socket using select( ) call. For first 16... (0 Replies)
Discussion started by: AshokG
0 Replies

2. UNIX for Dummies Questions & Answers

Problem with writing a program

Hi guys I'm having trouble with trying to create a script which calculates the grade of a student and the marks out of 300. The grades are: 0-49% fail 50-59% pass 60-69% credit pass 70-79% distinction 80-100% high distinction less than 0 or greater than 100 displays error message. My... (1 Reply)
Discussion started by: CompNoob
1 Replies

3. Programming

very bizzare file writing problem

I'm trying to write a function which opens a file pointer and writes one of the function parameters into the file, however for some reason Im getting a core dump error. The code is as below void WriteToFile(char *file_name, char *data) { FILE *fptr; /*disk_name_size is a... (10 Replies)
Discussion started by: JamesGoh
10 Replies

4. UNIX for Dummies Questions & Answers

Problem writing file path to txt file

if test -z "$1" then echo "you must give a filename or filepath" else path=`dirname $1` f_name =`basename $1` if path="." then path=`pwd` fi fi cat $f_name $path >> index.txt The only problem I am encountering with this is writing $path to index.txt Keeps going gaga: cat:... (1 Reply)
Discussion started by: Vintage_hegoog
1 Replies

5. Shell Programming and Scripting

Script writing problem

Self professed idot looking for help LOL Hi all, I am new to Unix and I have to write a shell script that will check to see if a file exist and then create it if it does not. The file I need to search for is titled "A1. dat" and here is my feeble attempt at creating the script: #!/bin/bash... (2 Replies)
Discussion started by: Tinablue
2 Replies

6. Shell Programming and Scripting

Problem in writing the data to a file in one row

Hi All I am reading data from the database and writing to temporary file in the below format. 1=XP|external_component|com.adp.meetingalertemail.processing.MeetingAlertEmail|EMAILALERTPUSH|32|4#XP |classpath|/usr/home/dfusr/lib/xalan.jar: /usr/home/dfusr/lib/xerces.jar: ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

7. Shell Programming and Scripting

Problem writing to different files

Hello: I have the following code: ---------------------------------- open (OUTPUT_FILE, ">>/usr/users/rovolis/PREPAID/CC/TCG/PP.$cyear$cmonth$cday.txt")||die "$!"; 82 open (OUTPUT_FILE2, ">>/usr/users/rovolis/PREPAID/CC/TCG/PR.$cyear$cmonth$cday.txt")||die "$!"; 83 # ... (0 Replies)
Discussion started by: chriss_58
0 Replies

8. Shell Programming and Scripting

Problem with writing into a file through shell script

Hi all, I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below- #!/bin/bash while read line do connections=`echo $line | cut -d " " -f 1` period=`echo... (3 Replies)
Discussion started by: joydeep4u
3 Replies

9. Shell Programming and Scripting

Problem writing a search script

I trying to write a script in bash that take a list of users in “fileA” and searches another list user in “fileB” if the user does not exist in “file B” write the user to another file “file C”. Please note “fileA” and “fileB” contains over 1000 users Basically “fileA” “fileB” ... (2 Replies)
Discussion started by: hassan1
2 Replies

10. Shell Programming and Scripting

Problem with writing to output - awk, echo

Hello all, I wrote this command line for some calculation on my given input files based on another input file which is a txt file. while read BAM REGION; do samtools view $BAM $REGION | awk '{if ($2==0) print $0}' | wc -l >>log.txt; echo "$REGION"; done >> log.txt <regions.txt It takes... (4 Replies)
Discussion started by: @man
4 Replies
WRITE(1)						    BSD General Commands Manual 						  WRITE(1)

NAME
write -- send a message to another user SYNOPSIS
write user [ttyname] DESCRIPTION
write allows you to communicate with other users, by copying lines from your terminal to theirs. When you run the write command, the user you are writing to gets a message of the form: Message from yourname@yourhost on yourtty at hh:mm ... Any further lines you enter will be copied to the specified user's terminal. If the other user wants to reply, they must run write as well. When you are done, type an end-of-file or interrupt character. The other user will see the message 'EOF' indicating that the conversation is over. You can prevent people (other than the super-user) from writing to you with the mesg(1) command. Some commands, for example nroff(1) and pr(1), disallow writing automatically, so that your output isn't overwritten. If the user you want to write to is logged in on more than one terminal, you can specify which terminal to write to by specifying the termi- nal name as the second operand to the write command. Alternatively, you can let write select one of the terminals - it will pick the one with the shortest idle time. This is so that if the user is logged in at work and also dialed up from home, the message will go to the right place. The traditional protocol for writing to someone is that the string '-o', either at the end of a line or on a line by itself, means that it's the other person's turn to talk. The string 'oo' means that the person believes the conversation to be over. SEE ALSO
mesg(1), talk(1), who(1) HISTORY
A write command appeared in Version 6 AT&T UNIX. BSD
June 6, 1993 BSD
All times are GMT -4. The time now is 12:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy