Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!swift.cs.tcd.ie!ccvax.ucd.ie!h235_033 From: h235_033@ccvax.ucd.ie Newsgroups: comp.sys.amiga.misc Subject: Re: lattice C NOVICE question Message-ID: <1991Mar21.114116.48031@ccvax.ucd.ie> Date: 21 Mar 91 11:41:16 GMT References: <732@elctr.UUCP> Organization: University College Dublin Lines: 57 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.