[fpc-pascal]dumb question
Ok, guys. it's only been like 15 years since I have written any pascal code. Can someone please help me with syntax for opening a file so that I can read variable length lines of text from it, then output to another file. Running in DOS on an x86 machine. Thank you. Jason
Re: [fpc-pascal]dumb question
On Sun, 1 Aug 2004 [EMAIL PROTECTED] wrote: > Ok, guys. it's only been like 15 years since I have written any pascal code. > Can someone please help me with syntax for opening a file so that I can read > variable length lines of text from it, then output to another file. Running > in DOS on an x86 machine. Thank you. Here you are. Standard textbook examples. Also available in the manual. Michael. procedure ReadFile(FN : String); Var F : Text; S : String; begin Assign(F,FN); Reset(F); While not EOF(F) do begin ReadLn(F,S); { Do something with S. } end; Close(F); end; procedure WriteFile(FN : String); Var F : Text; I : Integer; S : String; begin Assign(F,FN); Rewrite(F); For I:=0 to 100 do Writeln(F,'Writing string ',I); Close(F); end; ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]dumb question
[EMAIL PROTECTED] wrote: Ok, guys. it's only been like 15 years since I have written any pascal code. Can someone please help me with syntax for opening a file so that I can read variable length lines of text from it, then output to another file. Running in DOS on an x86 machine. Thank you. Hi Jason, procedure ReadFile(const FileName: string); var f: TextFile; st: string; begin assignfile(f,FileName); reset(f); while not eof(f) do begin readln(f, st); // here you are reading one line from the file at every loop // do what you want with st writeln(st); // for example end; closefile(f); end; // main begin ReadFile('c:\autoexec.bat'); end. -- Jilani ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]usb devices
Hi, I'd like to send/receive data to/from an usb device using Linux and Free Pascal, can I do this directly? I known how to access /dev/ttySn (com1, com2, cometc) and I'd like to do something similar with an usb device. Perhaps the best way is using libusb, but the link to fpcusb seems to be down and I can't find it anywhere. If someone can help. Thanks. -- (Please, if you can answer use the list, otherwise I won't receive it. Thanks) Salutacions Jordi ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]usb devices
Try this one http://cesnet.dl.sourceforge.net/sourceforge/libusb/libusb-0.1.8.tar.gz Lubomir Cabla/CBL > -Original Message- > From: jordi [mailto:[EMAIL PROTECTED] > Sent: Monday, August 02, 2004 12:01 PM > To: Llista Pascal > Subject: [fpc-pascal]usb devices > > > Hi, I'd like to send/receive data to/from an usb device using > Linux and > Free Pascal, can I do this directly? I known how to access /dev/ttySn > (com1, com2, cometc) and I'd like to do something similar with an usb > device. > > Perhaps the best way is using libusb, but the link to fpcusb > seems to be > down and I can't find it anywhere. > > > If someone can help. Thanks. > > -- > (Please, if you can answer use the list, otherwise I won't receive it. > Thanks) > > Salutacions > > Jordi > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]usb devices
El dl, 02-08-2004 a las 12:30, [EMAIL PROTECTED] escribió: > Try this one > http://cesnet.dl.sourceforge.net/sourceforge/libusb/libusb-0.1.8.tar.gz This is the c lib, but I'd like the pascal interface to this lib fpcusb. Thanks. -- (Please, if you can answer use the list, otherwise I won't receive it. Thanks) Salutacions Jordi ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]usb devices
On Monday 02 August 2004 12:43, jordi wrote: > El dl, 02-08-2004 a las 12:30, [EMAIL PROTECTED] escribió: > This is the c lib, but I'd like the pascal interface to this lib fpcusb. OK. I had the file somewhere on disk. Please find it attached. Regards, Pedro fpcusb.tgz Description: application/tgz
RE: [fpc-pascal]usb devices
Sorry. This one if for TP7.0 you can convert it to FPC. http://pascal.sources.ru/hardware/usb4pas.htm Lubomir Cabla/CBL > -Original Message- > From: jordi [mailto:[EMAIL PROTECTED] > Sent: Monday, August 02, 2004 12:44 PM > To: Llista Pascal > Subject: RE: [fpc-pascal]usb devices > > > El dl, 02-08-2004 a las 12:30, [EMAIL PROTECTED] escribió: > > Try this one > > > http://cesnet.dl.sourceforge.net/sourceforge/libusb/libusb-0.1 > .8.tar.gz > > This is the c lib, but I'd like the pascal interface to this > lib fpcusb. > > Thanks. > -- > (Please, if you can answer use the list, otherwise I won't receive it. > Thanks) > > Salutacions > > Jordi > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]usb devices
El dl, 02-08-2004 a las 12:51, [EMAIL PROTECTED] escribió: > Sorry. This one if for TP7.0 you can convert it to FPC. > http://pascal.sources.ru/hardware/usb4pas.htm > > OK. I had the file somewhere on disk. Please find it attached. > > > > Thank all. > > -- (Please, if you can answer use the list, otherwise I won't receive it. Thanks) Salutacions Jordi ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Programs don't come back
Fedora core II. My programs seem to take over the whole screen and when they finish the system is stuck. Linux doesn't come back. I have to reboot every time. There are no loops.. just hitting "END.". Any suggestions? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
> Fedora core II. My programs seem to take over the whole screen and > when they finish the system is stuck. Linux doesn't come back. I have > to reboot every time. There are no loops.. just hitting "END.". > > Any suggestions? Some problem with that distribution, or the packages you installed. User programs shouldn't be able to bring down the system under Linux. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
Do you call closegraph? I'm converting Turbo code... probably making some mistakes On Aug 2, 2004, at 11:05 AM, Agustin Barto wrote: I have FC2 (with prelinking and exec-shield enabled) and the programs work just fine. I'm using fpc-1.9.4. On Mon, 2 Aug 2004 19:57:21 +0200 (CEST), Marco van de Voort <[EMAIL PROTECTED]> wrote: Fedora core II. My programs seem to take over the whole screen and when they finish the system is stuck. Linux doesn't come back. I have to reboot every time. There are no loops.. just hitting "END.". Any suggestions? Some problem with that distribution, or the packages you installed. User programs shouldn't be able to bring down the system under Linux. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
I have FC2 (with prelinking and exec-shield enabled) and the programs work just fine. I'm using fpc-1.9.4. On Mon, 2 Aug 2004 19:57:21 +0200 (CEST), Marco van de Voort <[EMAIL PROTECTED]> wrote: > > Fedora core II. My programs seem to take over the whole screen and > > when they finish the system is stuck. Linux doesn't come back. I have > > to reboot every time. There are no loops.. just hitting "END.". > > > > Any suggestions? > > Some problem with that distribution, or the packages you installed. > > User programs shouldn't be able to bring down the system under Linux. > > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
On Mon, 2 Aug 2004 12:40:37 -0700 Jeff Weeks <[EMAIL PROTECTED]> wrote: > Fedora core II. My programs seem to take over the whole screen and > when they finish the system is stuck. Linux doesn't come back. I have > to reboot every time. There are no loops.. just hitting "END.". > > Any suggestions? > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal Tried to press Ctl-Alt-F7 to get back to the X11 window? I've had some old graphics programs switch to a text terminal window. John ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
Thanks, I'll try that! The clrscr function seems to be the culprit. When it hits that it clears the screen, puts up an old pong-style mouse cursor, and I can't get back to Linux. I don't think it's switching to graphics mode. Just some text mode like you suggest. Jeff On Aug 2, 2004, at 11:52 AM, John Coppens wrote: On Mon, 2 Aug 2004 12:40:37 -0700 Jeff Weeks <[EMAIL PROTECTED]> wrote: Fedora core II. My programs seem to take over the whole screen and when they finish the system is stuck. Linux doesn't come back. I have to reboot every time. There are no loops.. just hitting "END.". Any suggestions? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal Tried to press Ctl-Alt-F7 to get back to the X11 window? I've had some old graphics programs switch to a text terminal window. John ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
Ctrl-Alt-F7 works. Then I tried the maze sample and it comes back. So I'll figure out what it's doing differently. Thanks, everyone. Jeff On Aug 2, 2004, at 2:58 PM, Jeff Weeks wrote: Thanks, I'll try that! The clrscr function seems to be the culprit. When it hits that it clears the screen, puts up an old pong-style mouse cursor, and I can't get back to Linux. I don't think it's switching to graphics mode. Just some text mode like you suggest. Jeff On Aug 2, 2004, at 11:52 AM, John Coppens wrote: On Mon, 2 Aug 2004 12:40:37 -0700 Jeff Weeks <[EMAIL PROTECTED]> wrote: Fedora core II. My programs seem to take over the whole screen and when they finish the system is stuck. Linux doesn't come back. I have to reboot every time. There are no loops.. just hitting "END.". Any suggestions? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal Tried to press Ctl-Alt-F7 to get back to the X11 window? I've had some old graphics programs switch to a text terminal window. John ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Programs don't come back
On Mon, 2 Aug 2004 16:08:01 -0700 Jeff Weeks <[EMAIL PROTECTED]> wrote: > Ctrl-Alt-F7 works. > > Then I tried the maze sample and it comes back. So I'll figure out > what it's doing differently. > > Thanks, everyone. > > Jeff Hi Jeff... Getting the graph thing to work is delicate (to say the least). Please take into account you have to use the special hi resolution constants for the display... Such things as 'm800x600' for the modes. In the reference manual for the graph library you'll find more on that (Check 'A word about mode selection'). I more or less gave up on using graph - it's a bit of a headache to have the video switch modes, particularly while debugging. I don't know if there is a more elegant solution, apart from trying to open a new window with a gnome-canvas in it or so. John ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal