GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Does anyone here program in Pascal? (https://gfy.com/showthread.php?t=52470)

ldinternet 03-02-2002 03:33 PM

Does anyone here program in Pascal?
 
Its shitty, I know. :)

After creating a file (lets say, c:\notes.txt) or overwriting an existing file, writing to file, reading from file and storing in memory, deleting the contents of the file, and writing to screen from memory, is there any way to delete that file from disk?

I've been looking for a sample code for this but I can't find it anywhere... any help would be appreciated. :glugglug

Nysus 03-02-2002 03:37 PM

Pascal? I learned that.. when I was .... uhm... 13? ... hehe..

Cheers

Pipecrew 03-02-2002 03:39 PM

Pascal is so old Jesus CoWrote the manual

ldinternet 03-02-2002 03:39 PM

Yeah, most of it is easy. Afterall, its an educational language.

We're touching on it as a part of the file concepts unit.

Just can't get my head around how to delete a file from disk. I don't think its possible. Did somebody say "malicious user"? ;)

-=HUNGRYMAN=- 03-02-2002 03:53 PM

not since grade 11 computer sciences ... hehehe

we learnt it on those british "ICON" computers ... weren't all that bad of a machine for the time really ... better than PETs

:thumbsup

waste 03-02-2002 05:15 PM

man your talking ancent shit now, i have done Pascal work since dial-up BBS's
were still big

ldinternet 03-02-2002 05:20 PM

You should remember at least a little. ;)

Done all the simple shit, so heres what I got so far... options 1 through 4 aren't working yet ;)

program cinema_pas;

uses wincrt;

var
continue:string;
clear:integer;
menuoption:char;
notation:string;
notefile:text;
username:string[10];
password:array[1..10] of char;
login:array[1..20] of string;
pass:array[1..20] of string;
protect:char;
user:string;
pw:string;
i:integer; {for controlling variable}
num:integer; {another controlling variable}
x:integer;
y:integer; {x and y coordinates}
halter:integer;


begin

clear:=clear+1;

if clear=1 then begin
assign(notefile,'c:\notes.txt');
rewrite(notefile);
close(notefile);
end;


{ PART ONE BEGIN }

clrscr;

gotoxy(5,2);
write('Welcome to the Cinema Ticket System');

gotoxy(5,4);
write('You will be asked for a username and password');
gotoxy(5,5);
write('Press any key to continue');
gotoxy(30,5);
readkey;

{PART ONE END }

login[1]:='staffone';
login[2]:='stafftwo';
protect:='*';

repeat
pw:=('');

repeat

halter:=halter+1;

clrscr;
gotoxy(5,2);
write('Please enter your password then press ENTER');
gotoxy(5,4);
write('Username: ');
readln(username);
gotoxy(5,5);
write('Password: ');

if halter=5 then
begin
gotoxy(5,5);
writeln('Too many incorrect attempts... program closing');
halt;
end;

until (username=login[1]) or (username=login[2]);
y:=15;
num:=5;

for i:=1 to num do
begin
password[i]:=readkey;
gotoxy(y,5);
write (protect);
y:=y+1;
end;

i:=1;

for i:=1 to num do
begin
pw:=pw+password[i];
end;
pass[1]:='somet'; pass[2]:='tsome';;

until
(username=login[1]) and (pw=pass[1]) or
(username=login[2]) and (pw=pass[2]);

begin
readkey;
gotoxy(5,7);
write('You are now logged in');
gotoxy(5,8);
write('Press any ENTER to continue');
readln;
end;

repeat

{PART TWO BEGIN}

clrscr;

gotoxy(5,2);
write('Main menu screen');

gotoxy(5,3);
write('Logged in as user: ',user);

gotoxy(5,5);
write('Customer related');
gotoxy(5,6);
write('1. Reserve a seat');
gotoxy(5,7);
write('2. Cancel a reservation');
gotoxy(5,8);
write('3. Display current seating plan');
gotoxy(5,9);
write('4. Write seating plan to file');

gotoxy(5,11);
write('Non customer related');
gotoxy(5,12);
write('A. Make notation');
gotoxy(5,13);
write('B. Retreive notation');

{PART TWO END}

gotoxy(5,15);
write('Please select an option (1-4 or A-B): ');
readln(menuoption);

if (menuoption='A') or (menuoption='a') then begin
clrscr;

gotoxy(5,2);
write('You chose: Non customer related');
gotoxy(5,3);
write('Option: A, Make notation');

gotoxy(5,5);
writeln('Make notes below, press ENTER to save to file:');
gotoxy(5,7);
assign(notefile,'c:\notes.txt');
rewrite(notefile);
read(notation);

writeln(notefile,notation);
close(notefile);

clrscr;

gotoxy(5,2);
write('Input has been saved.');
gotoxy(5,4);
write('You will be returned to the main menu');
gotoxy(5,5);
write('Press any key to continue');
readkey;

end;

if (menuoption='B') or (menuoption='b') then begin
clrscr;

assign(notefile,'c:\notes.txt');
reset(notefile);
readln(notefile,notation);
write(notation);
close(notefile);

if notation='' then
begin
gotoxy(5,2);
write('The note file is empty');
end;

gotoxy(5,4);
write('Press any key to continue');
readkey;
end;

begin

clrscr;

gotoxy(5,2);
write('Return to main menu or exit the program?');
gotoxy(5,3);
write('Press any key to continue or type EXIT');
gotoxy(5,4);
write('(case sensitive) to exit the program');
gotoxy(8,6);
write('WARNING: All data will be lost on exit!');
gotoxy(5,8);
readln(continue);

end;

until continue='EXIT';

end.

-=HUNGRYMAN=- 03-03-2002 12:07 AM

I'm drunk ... and now my brain hurts :(

(sorry Rollin ... I fell off the wagon)


All times are GMT -7. The time now is 05:22 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123