harry@demon.co.uk (Harry Broomhall) (03/21/91)
In article <732@elctr.UUCP> dsn@elctr.UUCP (Dan Soeren Nielsen) writes: > > I'v checked it for typing errors several times, but I still end up at >the Guru. It seems that the "fprinf" can't be used together with "Open" >and "Write" should be used instead. > Is this an error in the book or is the problem due to incompatibility >with the Lattice compiler? > You are quite right. Functions that deal with the 'streams' interface cannot be used with the Dos library. Use sprintf to a buffer, and Write the buffer. > By the way; Where do I find a description of the functions in dosextens Have you got the Rom Kernal Manuals (RKMs) ? No Amiga programmer should be without these. In addition you will need the AmigaDos book from Bantam, even though it is a little out of date. All these books are only available in English, but given the good English in your posting I would guess that this will not be a problem. Regards, Harry.
h235_033@ccvax.ucd.ie (03/21/91)
In article <732@elctr.UUCP>, dsn@elctr.UUCP (Dan Soeren Nielsen) writes: > > Hi there, can someone help me with some beginners problems. > > I'm quit new to programming in C, but after a short course at my company > (using Turbo C on PC) I thought I was ready to start with some basic > examples on a Amiga (using Lattice Ver 5.0). > I started out by typing in the first example in "Amiga bogen", the danish > version of "Programmer's guide to the Amiga" by Robert A.Peck. You will > see the program below: > > #include "libraries/dosextens.h" > extern struct FileHandle *Open(); > > main() > { > struct FileHandle *dos_fh; > if (dos_fh = Open("*",MODE_OLDFILE)) > { > fprintf(dos_fh,"%ls","Hello there!\n"); > Close(dos_fh); > > } > else > printf("Error!!\n"); > > } > > I'v checked it for typing errors several times, but I still end up at > the Guru. It seems that the "fprinf" can't be used together with "Open" > and "Write" should be used instead. > Is this an error in the book or is the problem due to incompatibility > with the Lattice compiler? > > By the way; Where do I find a description of the functions in dosextens > > > I'll be greatfull if somebody could help me out. > > Klaus > --- > If this posting contains opinions, they are my own and not that of my > employer. > > > E-mail address : kv@elctr.dk Hi, this seems really obvious, but to my knowledge fprintf takes a file pointer as its first arg, not a struct FileHandle *. In general when messing with files on the Amiga, I just use fopen, fclose, fread, fwrite, fcreate,etc, or if running under UNIX, then open, close, read, write, creat, etc. All these fctns are detailed in K&R's book on ANSI C. it->Nuttchen->Steven.