File primitive operations

Asked by adithya

i am doing an assignment for file manipulation using primitve operations such as "open","close","creat","read","write","lseek","fstat" ..i did a program in which i am creating a file then opening it then writing and reading it..i would like to add one thing that is if the file isn't open or created then while performing any other operation it should give me an error but it doesn't give so.. can u help me ??

i am sending the program i have done..not all operations i have done..yet it is sufficient to solve my problem..i would like to know the code to 'display the error' ..
Thank you.

ProblemType: Bug
Architecture: i386
Date: Sun Oct 19 17:31:43 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/bin/gnome-terminal
Package: gnome-terminal 2.22.1-0ubuntu2
PackageArchitecture: i386
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gnome-terminal
Uname: Linux 2.6.24-16-generic i686

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was originally filed as bug #285883.

Revision history for this message
adithya (24adithya) said :
#1
Revision history for this message
Ralph Janke (txwikinger) said :
#2

Thank you for taking the time to report this issue and helping to make Ubuntu better. Examining the information you have given us, this does not appear to be a bug report so we are closing it and converting it to a question in the support tracker. We appreciate the difficulties you are facing, but it would make more sense to raise problems you are having in the support tracker at https://answers.launchpad.net/ubuntu if you are uncertain if they are bugs. For help on reporting bugs, see https://help.ubuntu.com/community/ReportingBugs .

Revision history for this message
Ralph Janke (txwikinger) said :
#3

Thanks for asking this question.

Look at i.e. the man page for write http://linux.die.net/man/2/write . As you can see the function returns an error code if writing to the function does not succeed. You can assign this value to a variable or directly test it in an expression.

I hope this helps.

Can you help with this problem?

Provide an answer of your own, or ask adithya for more information if necessary.

To post a message you must log in.