|
|
 |
 |
 |
 |
read and write
hello friends, can anyone explain me how to use read() write() function in C. and also how to read a file from disk and show it on the monitor using onlu read(), write() function ??????
In article <1180462250.312530.271@g37g2000prf.googlegroups.com>, asit dhal <penasit@gmail.com> wrote: >hello friends, >can anyone explain me how to use read() write() function in C.
By using the stdio input and output functions; on an OS where it makes sense to use read() and write(), the standard library will almost definitely call them to do the actual input and output. >and also how to read a file from disk and show it on the monitor using >onlu read(), write() function ??????
By using system-specific details that are beyond the scope of comp.lang.c. dave -- Dave Vandervies dj3va@csclub.uwaterloo.ca I _am_ consistent - if one of those other pointer guide writers came here and asked for comments, they'd get chewed out just as badly. --Richard Bos in comp.lang.c
"asit dhal" <penasit@gmail.com> schrieb im Newsbeitrag news:1180462250.312530.271180@g37g2000prf.googlegroups.com... > hello friends, > can anyone explain me how to use read() write() function in C.
No such functions in C89 or C99. They are in POSIX though, so the guye in comp.unix.programmer would know about them > and also how to read a file from disk and show it on the monitor using > onlu read(), write() function ??????
No, won't work. At least open() would be needed in addition, close() too. And standard C doesn't have the notion of disk nor monitor. The closest thing to monitor would probably be stdout... and a process gets it for granted. Pseudo code (and without error handling): file = open(filename, read) do bytesread=read(file, buffer, sizeof buffer) write(stdout_fileno, buffer, bytesread) until file hits EOF close (file) Implementation left as an exercise (homework?) to the OP... Bye, Jojo
asit dhal wrote: > hello friends, > can anyone explain me how to use read() write() function in C.
There are no functions read() and write() in C. There are various functions with those names for different implementations and platforms, the most common ones being the POSIX functions of those naems. To use them you must be using an appropriate implementation and include non-standard headers, identifying streams in a non-standard way. > and also how to read a file from disk and show it on the monitor using > onlu read(), write() function ??????
In C one can read an input stream, opened with fopen(), read it with fread() among others, and write it to an output stream with fwrite() among otheres. Even in implementations supporting the POSIX read() and write() functions what you ask for is impossible. Among other things, you must somehow open the file you want to read, unless redirected on the command line as the stdin stream, which requires a function other than read() and write().
asit dhal wrote: > can anyone explain me how to use read() write() function in C. > and also how to read a file from disk and show it on the monitor > using onlu read(), write() function ??????
There is no read nor write function in C. Look up such things as fopen, fclose, fread, fwrite. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
On May 29, 10:52 pm, CBFalconer <cbfalco@yahoo.com> wrote: Let be honest, then, there are no functions fopen, fclose, fread, fwrite neither in C. C is just a "shell", that contains only syntax. open, close, write and read are functions supported by the O.S. as part of drivers interface, and stdio functions use them implicitly, cause there's no way to write/read, open/close any device without these functions - they are embedded in the drivers directly, and given by the O.S. through various interfaces (e.g. a C library) Ask about these on comp.unix.programmer.
In article <1180483922.942146.78@k79g2000hse.googlegroups.com>, Darko <darko.maksimo @gmail.com> wrote: >On May 29, 10:52 pm, CBFalconer <cbfalco @yahoo.com> wrote: >> There is no read nor write function in C. Look up such things as >> fopen, fclose, fread, fwrite. >Let be honest, then, there are no functions fopen, fclose, fread, >fwrite neither in C. ISO 9899 disagrees with you. dave -- Dave Vandervies dj3va@csclub.uwaterloo.ca >Just promise to never show up at a BOFHBOF in Spandex and it's all moot.
Being Canadian, my favourite specialty fabric is Thinsulate. --Graham Reed and Anthony de Boer in the scary devil monastery
In article <1180483922.942146.78@k79g2000hse.googlegroups.com>, Darko <darko.maksimo @gmail.com> wrote: >Let be honest, then, there are no functions fopen, fclose, fread, >fwrite neither in C. C is just a "shell", that contains only syntax. >open, close, write and read are functions supported by the O.S. as >part of drivers interface, and stdio functions use them implicitly, >cause there's no way to write/read, open/close any device without >these functions - they are embedded in the drivers directly, and given >by the O.S. through various interfaces (e.g. a C library) >Ask about these on comp.unix.programmer. And if one is not using Unix? You are making an assertion about how *all* systems work. That assertion is not true for a number of systems. For example, there are systems which have no drivers interface at all. -- If you lie to the compiler, it will get its revenge. -- Henry Spencer
Darko said: > On May 29, 10:52 pm, CBFalconer <cbfalco @yahoo.com> wrote: >> asit dhal wrote: >> > can anyone explain me how to use read() write() function in C. >> > and also how to read a file from disk and show it on the monitor >> > using onlu read(), write() function ?????? >> There is no read nor write function in C. Look up such things as >> fopen, fclose, fread, fwrite. > Let be honest, then, there are no functions fopen, fclose, fread, > fwrite neither in C.
Should I believe you, or the ISO C Standard? Hmmm. Think think think... -- Richard Heathfield "Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk email: rjh at the above domain, - www.
Darko <darko.maksimo @gmail.com> writes: > On May 29, 10:52 pm, CBFalconer <cbfalco @yahoo.com> wrote: >> asit dhal wrote: >> > can anyone explain me how to use read() write() function in C. >> > and also how to read a file from disk and show it on the monitor >> > using onlu read(), write() function ?????? >> There is no read nor write function in C. Look up such things as >> fopen, fclose, fread, fwrite. [signature snipped] > Let be honest, then, there are no functions fopen, fclose, fread, > fwrite neither in C. C is just a "shell", that contains only syntax.
Let's be correct as well as honest. The C language is defined by the ISO C standard (either the 1990 or the 1999 version; the differences are not relevant in this case). That standard defines the fopen, fclose, fread, and fwrite functions in section 7, along with a plethora of other functions. (Most of these are required only for hosted implementations, but that's beside the point.) These functions are part of the C language, just as much as the syntax *and semantics* defined in section 6. (A minor quibble: the standard's section 6, describing syntax and semantics, is titled "Language", and section 7 is titled "Library", but they're both part of the C standard, and part of C.) > open, close, write and read are functions supported by the O.S. as > part of drivers interface, and stdio functions use them implicitly, > cause there's no way to write/read, open/close any device without > these functions - they are embedded in the drivers directly, and given > by the O.S. through various interfaces (e.g. a C library)
That depends on the operating system. On some C implementations, the fopen, fclose etc. functions might be implemented using some other lower-level functions; the OS might not even have functions called "open" and "close", or it may have functions with those names that do something entirely different than what the POSIX-specified functions do. On yet other C implementations, fopen and fclose might even be implemented by directly acessing the hardware. > Ask about these on comp.unix.programmer.
... where you're more likely to get accurate answers. -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"
Darko wrote:
Usenet account fromhttp://www.teranews.com > Let be honest, then, there are no functions fopen, fclose, fread, > fwrite neither in C.
Let us be honest, then. The above is just plain crap. If "Darko" is a student, he should learn better. If he claims to be a programmer, he should be fired. > C is just a "shell", that contains only syntax.
Let us be honest, then. The above either is meaningless or is pure crap.
On 2007-05-29 17:12:02 -0700, Darko <darko.maksimo@gmail.com> said:
> On May 29, 10:52 pm, CBFalconer <cbfalco @yahoo.com> wrote: >> asit dhal wrote: >>> can anyone explain me how to use read() write() function in C. >>> and also how to read a file from disk and show it on the monitor >>> using onlu read(), write() function ?????? >> There is no read nor write function in C. Look up such things as >> fopen, fclose, fread, fwrite. >> -- >> <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> >> <http://www.securityfocus.com/columnists/423> >> <http://www.aaxnet.com/editor/edit043.html> >> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> >> cbfalconer at maineline dot net >> -- >> Posted via a free Usenet account fromhttp://www.teranews.com > Let be honest, then, there are no functions fopen, fclose, fread, > fwrite neither in C.
Umm, the C standard says otherwise. -- Clark S. Cox III clarkc@gmail.com
On May 30, 6:24 am, Clark Cox <clarkc@gmail.com> wrote:
> On 2007-05-29 17:12:02 -0700, Darko <darko.maksimo @gmail.com> said: > > On May 29, 10:52 pm, CBFalconer <cbfalco@yahoo.com> wrote: > >> asit dhal wrote: > >>> can anyone explain me how to use read() write() function in C. > >>> and also how to read a file from disk and show it on the monitor > >>> using onlu read(), write() function ?????? > >> There is no read nor write function in C. Look up such things as > >> fopen, fclose, fread, fwrite. > >> -- > >> <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> > >> <http://www.securityfocus.com/columnists/423> > >> <http://www.aaxnet.com/editor/edit043.html> > >> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> > >> cbfalconer at maineline dot net > >> -- > >> Posted via a free Usenet account fromhttp://www.teranews.com > > Let be honest, then, there are no functions fopen, fclose, fread, > > fwrite neither in C. > Umm, the C standard says otherwise. > -- > Clark S. Cox III > clarkc@gmail.com
I am sorry to have disturbed emotions of so many people here, I did not intend to do that. Luckily, my employer is not so tough and strict as some of you folks are, so I think I won't get fired soon. Maybe later. As Keith Thompson noticed, the ISO 9899 C standard also lists functions in the Library section, but I wouldn't dare calling it a "minor quibble". Since, if one took to read the whole standard or at least to look at it in detail, would see some key sentences when the author(s) clearly distinguished the Language and the Library. Furthermore, besides the Standard Library, there are other things that this document talks about, which are also not a part of the language. Quote: "This International Standard is divided into four major subdivisions: preliminary elements (clauses 1 4); the characteristics of environments that translate and execute C programs (clause 5); the language syntax, constraints, and semantics (clause 6); the library facilities (clause 7)." ("Introduction", page xiv) Would we be so courageous to call "The characteristics of environments that translate and execute C programs" also a part of C? I will let you answer this question, since I don't want to risk more yelling and offending. Perhaps you have a different answer because it is mentioned and talked about "in the standard". Quote: "....added to this International Standard. Subclauses in the __language__ and __library__ clauses warn implementors and programmers of usages which, though valid in themselves, may con ict with future additions." ".....or new programs (for language [6.11] or library features [7.26]) is discouraged." ("Introduction, page xiv) These quotes also clearly distinguish the language from the library. It seems that it all comes down to the question what "C" is - the library, the library and the language, or the language. If it's the point of opinion, then I say it's the language. I probably think so because of all the language structures such as "the C programming language" and categories "Programming languages" when we always see C among others etc. It is also, in my opinion, somewhat absurd that all of these libraries are part of "C", whatever it is, since they contain many things that exist now but will not later, because of all the technology advances. Even this ISO 9899 standard says the similar thing: "With the introduction of new devices and extended character sets, new features may be added to this International Standard." ("Introduction", page xiv) So, the standard is extensible, because it contains libraries aside from the language itself. Let's make an example - can some of the following headers (mentioned in the document, as part of the standard library) be considered a part of "C": <signal.h> <setjmp.h> Do all architectures even have these features, or if they do, do all the operating systems have these features? I think not, so I also think they can't be part of "Standard C", although they maybe can be mentioned in the "Standard Library", since one doesn't really have to have the complete standard library in order to program in C. I am sorry again to have annoyed you, I know I'm offending your sense of being the smartest and the completest programmers, but there is such thing as fair and civilised argument that's not supposed to have words "crap" in it and rude behaviour. Regards, Darko P.S. Considering the comments about drivers, I admit my knowledge doesn't reach that much; I was trying to help as long as we are talking about systems that are most likely to have any connection with someone who doesn't know how to use read() and write(), thus not taking into account systems that don't have drivers or don't have read/ write/open/close functions in their interfaces. I agree there are such systems, but I have never had a chance to get in touch with them, but most probably are also totally irrelevant for this topic, since asit dhal asked about exactly these functions. When I directed him to comp.unix.programmer, I didn't imply only Unix has this interface, but I thought folks from this group are most likely to help him, and it is justified to ask the question there. So, instead of saying "sod off" to all of you, which I should, I will just let you be what you are. Have a nice day.
In article <1180540264.100952.7@q69g2000hsb.googlegroups.com> Darko <darko.maksimo @gmail.com> wrote: >... These quotes also clearly distinguish the language from the library. What I think you have missed here is that the C standards (C89 and C99 both) split the world into two: "hosted implementations" and "freestanding". A "hosted" implementation is *required* to have the full Standard C Library, and -- though this is not "required", merely "allowed" -- a hosted compiler can assume that a call to, e.g., printf() or sqrt() does only what the C Standard says it does, and *remove the call* from a compiled program, replacing it with something that suffices given the actual arguments. Some compilers do in fact do this. In an extreme case, printf("%f\n", sqrt(4.0)); could compile to the same machine code as: puts("2.000000"); (in practice this particular line usually still calls printf(), but on some compilers, passes 2.0 directly, without first calling sqrt(); some other printf() calls are turned into puts() calls though -- and note that the newline is removed from the string when printf() is changed into puts()). >It seems that it all comes down to the question what "C" is ...
It is what the C Standard says it is, provided all parties agree to the C Standard (which then brings up the case of "*which* C standard" of course :-) ): >- the library, the library and the language, or the language.
Going by the C Standard (either C89 or C99), it is never just "the library"; it is usually "the library and language combined", but for "freestanding" systems, it is "the language, plus at least a few parts of the library as listed, plus anything the freestanding system includes anyway". (See the Standard's section on conformance.) >So, the standard is extensible, because it contains libraries aside >from the language itself. Let's make an example - can some of the >following headers (mentioned in the document, as part of the standard >library) be considered a part of "C": ><signal.h> <setjmp.h>
<signal.h> is not required in a freestanding implementation, but is required (along with its corresponding functions) in any hosted implementation. Note that the functions can be quite trivial, e.g., signal() can simply return SIG_ERR much of the time. <setjmp.h> is similar, except that setjmp and longjmp cannot be implemented trivially (a correct call to longjmp() must always perform the requested "go to"). On the other hand, for instance, <stddef.h> is always required, even in freestanding implementations. -- In-Real-Life: Chris Torek, Wind River Systems Salt Lake City, UT, USA (4039.22'N, 11150.29'W) +1 801 277 2603 email: forget about it http://web.torek.net/torek/index.html Reading email is like searching for food in the garbage, thanks to spammers.
Darko wrote: > Let be honest, then, there are no functions fopen, fclose, fread, > fwrite neither in C.
This takes the prize of the most clueless post I have read in a very long time! ROFL -- Tor <torust [at] online [dot] no>
Darko <darko.maksimo @gmail.com> writes: > On May 30, 6:24 am, Clark Cox <clarkc @gmail.com> wrote: >> On 2007-05-29 17:12:02 -0700, Darko <darko.maksimo @gmail.com> said: >> > On May 29, 10:52 pm, CBFalconer <cbfalco @yahoo.com> wrote: >> >> asit dhal wrote: >> >>> can anyone explain me how to use read() write() function in C. >> >>> and also how to read a file from disk and show it on the monitor >> >>> using onlu read(), write() function ?????? >> >> There is no read nor write function in C. Look up such things as >> >> fopen, fclose, fread, fwrite. [snip] >> > Let be honest, then, there are no functions fopen, fclose, fread, >> > fwrite neither in C. >> Umm, the C standard says otherwise. > I am sorry to have disturbed emotions of so many people here, I did > not intend to do that. Luckily, my employer is not so tough and strict > as some of you folks are, so I think I won't get fired soon. Maybe > later. > As Keith Thompson noticed, the ISO 9899 C standard also lists > functions in the Library section, but I wouldn't dare calling it a > "minor quibble". Since, if one took to read the whole standard or at > least to look at it in detail, would see some key sentences when the > author(s) clearly distinguished the Language and the Library. > Furthermore, besides the Standard Library, there are other things that > this document talks about, which are also not a part of the language.
[snip] Your original statement (see above) was that "... there are no functions fopen, fclose, fread, fwrite neither in C." You didn't distinguish between the language and the library, you just said "in C". Both the "language" (described in section 6 of the standard) and the "library" (described in section 7) are indisputably part of C. Your statement was quite simply incorrect, and any distinction between "language" and "library" has nothing to do with it. For that matter, the standard document as a whole is titled "Programming Languages -- C". The term "language" is ambiguous; it can refer either to what's described in section 6 of the standard, or to what's described by the standard as a whole, including the library. And I'm afraid that your error was a particularly blatant one. It's almost as if you had claimed that C doesn't have pointers, or that it doesn't have functions. I'm not saying this to be personally offensive. I'm merely trying to help you understand why there was such a strong reaction. This isn't about anger, or courage, or "disturbed emotions", or anything like that. This newsgroup is a community that values *correctness* above almost everything else. I've made mistakes here myself; no doubt some of them have been particularly boneheaded (no need to search for examples, thank you very much). One of the best things about this newsgroup is that mistakes are corrected. And now, you seem to be trying to justify your original statement, rather than simply admitting that you were mistaken. The reaction to your error may have seemed excessive, but it's a consequence of the way Usenet works. Usenet is fundamentally an asynchronous medium. Most of the respones were written before the responders had seen any of the other responses. I understand that it seemed like everyone was ganging up on you, but that wasn't the intent. [...] > I am sorry again to have annoyed you, I know I'm offending your sense > of being the smartest and the completest programmers, but there is > such thing as fair and civilised argument that's not supposed to have > words "crap" in it and rude behaviour.
Again, that's not what this is about. As for rudeness, I seriously suggest you try to grow a thicker skin. Yes, there's some rudeness here; it's best to ignore it and pay attention to the underlying message. [...] > So, instead of saying "sod off" to all of you, which I should, I will > just let you be what you are. Have a nice day.
Well, I'm sure we're all grateful that you merely *insinuated* saying "sod off" to all of us, rather than coming out and saying it. The quotation marks really help to soften the blow. (Did you know that the word "disingenuous" isn't in the dictionary?) -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"
Darko wrote, On 30/05/07 16:51:
> On May 30, 6:24 am, Clark Cox <clarkc @gmail.com> wrote: >> On 2007-05-29 17:12:02 -0700, Darko <darko.maksimo @gmail.com> said: >>> On May 29, 10:52 pm, CBFalconer <cbfalco@yahoo.com> wrote: >>>> asit dhal wrote: >>>>> can anyone explain me how to use read() write() function in C. >>>>> and also how to read a file from disk and show it on the monitor >>>>> using onlu read(), write() function ?????? >>>> There is no read nor write function in C. Look up such things as >>>> fopen, fclose, fread, fwrite. >>>> -- >>>> <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> >>>> <http://www.securityfocus.com/columnists/423> >>>> <http://www.aaxnet.com/editor/edit043.html> >>>> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> >>>> cbfalconer at maineline dot net >>>> -- >>>> Posted via a free Usenet account fromhttp://www.teranews.com >>> Let be honest, then, there are no functions fopen, fclose, fread, >>> fwrite neither in C. >> Umm, the C standard says otherwise. >> -- >> Clark S. Cox III >> clarkc@gmail.com
Pleas do not quote peoples signatures unless you are commenting on them. > I am sorry to have disturbed emotions of so many people here, I did > not intend to do that. Luckily, my employer is not so tough and strict > as some of you folks are, so I think I won't get fired soon. Maybe > later.
You have probably reduced the number of potential future employers by a few. There is more than one person here involved in recruitment for their companies. > As Keith Thompson noticed, the ISO 9899 C standard also lists > functions in the Library section, but I wouldn't dare calling it a > "minor quibble". Since, if one took to read the whole standard or at > least to look at it in detail, would see some key sentences when the > author(s) clearly distinguished the Language and the Library.
Yes, but the standards do not say that one is C and the other is not. > Furthermore, besides the Standard Library, there are other things that > this document talks about, which are also not a part of the language. > Quote: > "This International Standard is divided into four major subdivisions: > preliminary elements (clauses 1 4); > the characteristics of environments that translate and execute C > programs (clause 5); > the language syntax, constraints, and semantics (clause 6); > the library facilities (clause 7)." ("Introduction", page xiv)
You started reading to late. In C99, just before section 1, at the top of page 1, it says in bold large type, "Programming languages - C" thus indicating that the entire document is talking about C.
> Would we be so courageous to call "The characteristics of environments > that translate and execute C programs" also a part of C? I will let > you answer this question, since I don't want to risk more yelling and > offending. Perhaps you have a different answer because it is mentioned > and talked about "in the standard". > Quote: > "....added to this International Standard. Subclauses in the > __language__ and __library__ clauses warn > implementors and programmers of usages which, though valid in > themselves, may con ict with future additions." > ".....or new programs (for language [6.11] or library features [7.26]) > is discouraged." ("Introduction, page xiv) > These quotes also clearly distinguish the language from the library. > It seems that it all comes down to the question what "C" is - the > library, the library and the language, or the language. If it's the > point of opinion, then I say it's the language.
Most people seem to disagree with you. > I probably think so > because of all the language structures such as "the C programming > language" and categories "Programming languages" when we always see C > among others etc. It is also, in my opinion, somewhat absurd that all > of these libraries are part of "C", whatever it is, since they contain > many things that exist now but will not later, because of all the > technology advances. Even this ISO 9899 standard says the similar > thing: > "With the introduction of new devices and extended character sets, new > features may be > added to this International Standard." ("Introduction", page xiv)
That is saying things may be added to C, not that anything you can currently call from C is C. It also contradicts what you C does not include the standard C library. > So, the standard is extensible, because it contains libraries aside > from the language itself. Let's make an example - can some of the > following headers (mentioned in the document, as part of the standard > library) be considered a part of "C": > <signal.h> <setjmp.h> > Do all architectures even have these features, or if they do, do all > the operating systems have these features?
Shows how little you have read. > I think not, so I also > think they can't be part of "Standard C", although they maybe can be > mentioned in the "Standard Library", since one doesn't really have to > have the complete standard library in order to program in C.
However, any hosted implementation is required to include the entire standard C library, and prior to the standard the first edition of K&R says "Chapter 7 describes the standard C I/O library, which provides a common interface to the operating system. This I/O library is supported on all machines that support C... ^^^ So prior to the ANSI standard, to be considered a C implementation it had to have fopen etc. according to the nearest thing the language had to a definition. > I am sorry again to have annoyed you, I know I'm offending your sense > of being the smartest and the completest programmers, but there is
You have done nothing to indicate you are smarter or better, so I doubt that anyone thinks that.
> such thing as fair and civilised argument that's not supposed to have > words "crap" in it and rude behaviour. > Regards, > Darko > P.S. Considering the comments about drivers, I admit my knowledge > doesn't reach that much; I was trying to help as long as we are > talking about systems that are most likely to have any connection with > someone who doesn't know how to use read() and write(), thus not > taking into account systems that don't have drivers or don't have read/ > write/open/close functions in their interfaces. I agree there are such > systems, but I have never had a chance to get in touch with them, but > most probably are also totally irrelevant for this topic, since asit > dhal asked about exactly these functions. When I directed him to > comp.unix.programmer, I didn't imply only Unix has this interface, but > I thought folks from this group are most likely to help him, and it is > justified to ask the question there.
Unless he is using the Windows versions of those functions which are part of a subtly different interface and on Windows are not the low level functions they are on Unix. In any case, people were not complaining about you suggesting asking on comp.unix.programmer, they were complaining about you saying C does not have functions that the standard and all versions of K&R say it does have. > So, instead of saying "sod off" to all of you, which I should, I will > just let you be what you are. Have a nice day.
You can't stop us being what we are and you are unlikely to significantly impact on the quality of anyone's day here. -- Flash Gordon
On May 31, 12:49 am, Flash Gordon <s@flash-gordon.me.uk> wrote:
> Darko wrote, On 30/05/07 16:51: > > On May 30, 6:24 am, Clark Cox <clarkc@gmail.com> wrote: > >> On 2007-05-29 17:12:02 -0700, Darko <darko.maksimo@gmail.com> said: > >>> On May 29, 10:52 pm, CBFalconer <cbfalco@yahoo.com> wrote: > >>>> asit dhal wrote: > >>>>> can anyone explain me how to use read() write() function in C. > >>>>> and also how to read a file from disk and show it on the monitor > >>>>> using onlu read(), write() function ?????? > >>>> There is no read nor write function in C. Look up such things as > >>>> fopen, fclose, fread, fwrite. > >>>> -- > >>>> <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> > >>>> <http://www.securityfocus.com/columnists/423> > >>>> <http://www.aaxnet.com/editor/edit043.html> > >>>> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> > >>>> cbfalconer at maineline dot net > >>>> -- > >>>> Posted via a free Usenet account fromhttp://www.teranews.com > >>> Let be honest, then, there are no functions fopen, fclose, fread, > >>> fwrite neither in C. > >> Umm, the C standard says otherwise. > >> -- > >> Clark S. Cox III > >> clarkc@gmail.com > Pleas do not quote peoples signatures unless you are commenting on them. > > I am sorry to have disturbed emotions of so many people here, I did > > not intend to do that. Luckily, my employer is not so tough and strict > > as some of you folks are, so I think I won't get fired soon. Maybe > > later. > You have probably reduced the number of potential future employers by a > few. There is more than one person here involved in recruitment for > their companies. > > As Keith Thompson noticed, the ISO 9899 C standard also lists > > functions in the Library section, but I wouldn't dare calling it a > > "minor quibble". Since, if one took to read the whole standard or at > > least to look at it in detail, would see some key sentences when the > > author(s) clearly distinguished the Language and the Library. > Yes, but the standards do not say that one is C and the other is not. > > Furthermore, besides the Standard Library, there are other things that > > this document talks about, which are also not a part of the language. > > Quote: > > "This International Standard is divided into four major subdivisions: > > preliminary elements (clauses 1 4); > > the characteristics of environments that translate and execute C > > programs (clause 5); > > the language syntax, constraints, and semantics (clause 6); > > the library facilities (clause 7)." ("Introduction", page xiv) > You started reading to late. In C99, just before section 1, at the top > of page 1, it says in bold large type, "Programming languages - C" thus > indicating that the entire document is talking about C. > > Would we be so courageous to call "The characteristics of environments > > that translate and execute C programs" also a part of C? I will let > > you answer this question, since I don't want to risk more yelling and > > offending. Perhaps you have a different answer because it is mentioned > > and talked about "in the standard". > > Quote: > > "....added to this International Standard. Subclauses in the > > __language__ and __library__ clauses warn > > implementors and programmers of usages which, though valid in > > themselves, may con ict with future additions." > > ".....or new programs (for language [6.11] or library features [7.26]) > > is discouraged." ("Introduction, page xiv) > > These quotes also clearly distinguish the language from the library. > > It seems that it all comes down to the question what "C" is - the > > library, the library and the language, or the language. If it's the > > point of opinion, then I say it's the language. > Most people seem to disagree with you. > > I probably think so > > because of all the language structures such as "the C programming > > language" and categories "Programming languages" when we always see C > > among others etc. It is also, in my opinion, somewhat absurd that all > > of these libraries are part of "C", whatever it is, since they contain > > many things that exist now but will not later, because of all the > > technology advances. Even this ISO 9899 standard says the similar > > thing: > > "With the introduction of new devices and extended character sets, new > > features may be > > added to this International Standard." ("Introduction", page xiv) > That is saying things may be added to C, not that anything you can > currently call from C is C. It also contradicts what you C does not > include the standard C library. > > So, the standard is extensible, because it contains libraries aside > > from the language itself. Let's make an example - can some of the > > following headers (mentioned in the document, as part of the standard > > library) be considered a part of "C": > > <signal.h> <setjmp.h> > > Do all architectures even have these features, or if they do, do all > > the operating systems have these features? > Shows how little you have read. > > I think not, so I also > > think they can't be part of "Standard C", although they maybe can be > > mentioned in the "Standard Library", since one doesn't really have to > > have the complete standard library in order to program in C. > However, any hosted implementation is required to include the entire > standard C library, and prior to the standard the first edition of K&R > says "Chapter 7 describes the standard C I/O library, which provides a > common interface to the operating system. This I/O library is supported > on all machines that support C... > ^^^ > So prior to the ANSI standard, to be considered a C implementation it > had to have fopen etc. according to the nearest thing the language had > to a definition. > > I am sorry again to have annoyed you, I know I'm offending your sense > > of being the smartest and the completest programmers, but there is > You have done nothing to indicate you are smarter or better, so I doubt > that anyone thinks that. > > such thing as fair and civilised argument that's not supposed to have > > words "crap" in it and rude behaviour. > > Regards, > > Darko > > P.S. Considering the comments about drivers, I admit my knowledge > > doesn't reach that much; I was trying to help as long as we are > > talking about systems that are most likely to have any connection with > > someone who doesn't know how to use read() and write(), thus not > > taking into account systems that don't have drivers or don't have read/ > > write/open/close functions in their interfaces. I agree there are such > > systems, but I have never had a chance to get in touch with them, but > > most probably are also totally irrelevant for this topic, since asit > > dhal asked about exactly these functions. When I directed him to > > comp.unix.programmer, I didn't imply only Unix has this interface, but > > I thought folks from this group are most likely to help him, and it is > > justified to ask the question there. > Unless he is using the Windows versions of those functions which are > part of a subtly different interface and on Windows are not the low > level functions they are on Unix. In any case, people were not > complaining about you suggesting asking on comp.unix.programmer, they > were complaining about you saying C does not have functions that the > standard and all versions of K&R say it does have. > > So, instead of saying "sod off" to all of you, which I should, I will > > just let you be what you are. Have a nice day. > You can't stop us being what we are and you are unlikely to > significantly impact on the quality of anyone's day here. > -- > Flash Gordon
OK, I would just like to sum up for some people here that noone really thought that there are no functions printf/scanf/... in C, if the term includes the standard library as well. What I thought when I said "C" was C language, not C as in "C language and standard C library", and I still stand behind the fact that there is no printf in the C language. As for "clueless", "fired", "plain crap", massive sarcasm etc. the "sod off" but the disingenuousness too are still on ;-)
Darko <darko.maksimo @gmail.com> writes: [...] > OK, I would just like to sum up for some people here that noone really > thought that there are no functions printf/scanf/... in C, if the term > includes the standard library as well. What I thought when I said "C" > was C language, not C as in "C language and standard C library", and I > still stand behind the fact that there is no printf in the C language. > As for "clueless", "fired", "plain crap", massive sarcasm etc. the > "sod off" but the disingenuousness too are still on ;-)
*Please* trim quoted material to what's relevant to your followup. The term "C" does refer to the language and the standard library. See the C standard document, or a draft of it, to confirm this fact. Being simultaneously very rude and very wrong does not give a good impression. -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"
Darko wrote:
... snip about 150 lines ... > OK, I would just like to sum up for some people here that noone > really thought that there are no functions printf/scanf/... in C, > if the term includes the standard library as well. What I thought > when I said "C" was C language, not C as in "C language and > standard C library", and I still stand behind the fact that there > is no printf in the C language. As for "clueless", "fired", "plain > crap", massive sarcasm etc. the "sod off" but the disingenuousness > too are still on ;-)
You obviously haven't bothered to read the standard. The standard library is a part of that specification. Please snip your quotes. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
On Jun 5, 11:30 pm, CBFalconer <cbfalco@yahoo.com> wrote: No, YOU obviously haven't read the whole topic - read it first then reply.
Darko <darko.maksimo @gmail.com> writes: > On Jun 5, 11:30 pm, CBFalconer <cbfalco @yahoo.com> wrote: >> Darkowrote: >> ... snip about 150 lines ... >> > OK, I would just like to sum up for some people here that noone >> > really thought that there are no functions printf/scanf/... in C, >> > if the term includes the standard library as well. What I thought >> > when I said "C" was C language, not C as in "C language and >> > standard C library", and I still stand behind the fact that there >> > is no printf in the C language. As for "clueless", "fired", "plain >> > crap", massive sarcasm etc. the "sod off" but the disingenuousness >> > too are still on ;-) >> You obviously haven't bothered to read the standard. The standard >> library is a part of that specification. >> Please snip your quotes.
[signature snipped] > No, YOU obviously haven't read the whole topic - read it first then > reply.
Once again, please snip your quotes. You just quoted CBFalconer's rather lengthy signature block, which is irrelevant to your reply. We're asking you, when you post a followup, to delete any quoted text that isn't relevant to your followup. Signatures should always be snipped unless you're actually commenting on them, which you're not. I've read this entire thread, and I believe I've understood what everyone has written. You're wrong. The C standard library is part of C. -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"
Keith Thompson wrote: ... snip ... > Once again, please snip your quotes. You just quoted CBFalconer's > rather lengthy signature block, which is irrelevant to your reply. > We're asking you, when you post a followup, to delete any quoted text > that isn't relevant to your followup. Signatures should always be > snipped unless you're actually commenting on them, which you're not.
PoO: Actually my usual sig is only one line over the recommendation, and the lines are under 67 chars wide. Teranews adds another few with their added signature, which is not under my control. -- <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt> <http://www.securityfocus.com/columnists/423> <http://www.aaxnet.com/editor/edit043.html> <http://kadaitcha.cx/vista/dogsbreakfast/index.html> cbfalconer at maineline dot net -- Posted via a free Usenet account from http://www.teranews.com
CBFalconer <cbfalco @yahoo.com> writes: > Keith Thompson wrote: > ... snip ... >> Once again, please snip your quotes. You just quoted CBFalconer's >> rather lengthy signature block, which is irrelevant to your reply. >> We're asking you, when you post a followup, to delete any quoted text >> that isn't relevant to your followup. Signatures should always be >> snipped unless you're actually commenting on them, which you're not. > PoO: Actually my usual sig is only one line over the > recommendation, and the lines are under 67 chars wide. Teranews > adds another few with their added signature, which is not under my > control.
Understood. I was criticizing Darko for failing to snip your signature in his followup, not you for having a relatively large one. -- Keith Thompson (The_Other_Keith) k@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst> "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"
|
 |
 |
 |
 |
|