Re: basic file management

Steve Lamont (spl@szechuan.ucsd.edu)
Sun, 27 Apr 97 21:46:43 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> Can I get some sorce code for basic file management ?
> (e.g load text file from directory and save text data to a file or save
> as, etc..)
> I know I should make by myself.
> But I have no time so if it is not illegal, please let me know where I
> can down load such source codes, if you have any idea.

If you are using XForms, you should look at the discussion File
Selector goodie in the XForms manual. It does not actually read a
file or write a file but it relatively painlessly hands you a file
name which you can use for such a task.

To learn how to read and write files look at the fopen(), fread(),
fwrite(), and fprintf() functions in your online manual (type

man fopen

to get documenation on fopen(), for example). Also see the open(),
read(), and write() functions.

If the online manual's descriptions are insufficient to help you learn
how to do this, I suggest you refer to a C programming manual. There
are dozens of good references on basic C language programming in your
local library or bookstore. Kernighan and Ritchie or Harbison and
Steele come to mind as excellent tutorials on basic C programming.
Thompson and Ritchie's (I think -- I'm at home and my library is in my
office) _Programming in the UNIX Environment_ is an excellent general
programming tutorial concentrating on C but discussing the UNIX file
system from an application programmer's point of view in some detail.

I really hate to say RTFM but in this case I think that's probably the
best answer.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/