Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
no way to get the console handle Posted by eirinikat on 9 Jun 2009 at 4:20 AM
Hello,

i have a problem with pascal.
i use dev-pascal and i have just finished a program with files.
the program compiled with 0 errors but when i push execute an error appear. the error is "no way to get the console handle" .
i connect the files with the program.
If somebody could help me i would be very happy.
i cant find nothing in the internet.

Thanks a lot!!!
Report
Re: no way to get the console handle Posted by Actor on 9 Jun 2009 at 11:57 AM
Post your code.

Report
Re: no way to get the console handle Posted by eirinikat on 9 Jun 2009 at 11:48 PM
good morning,
the code of the program is the following

<program teliki_ergasia;
uses crt;

type eggrafi= {orizw ena neo tupo pou periexei ola ta pedia ths kathe eggrafhs pou tha dhmiourgeitai}
record
kwdikos:string[4];
eponimia:string[50];
dieuthinsi:string[50];
poli:string[30];
tax_kwd:string[5];
afm:string[9];
doy:string[30];
hmerominia:string[8];
apografi:integer;
sinoliki_xrewsi:integer;
sinoliki_pistwsi:integer;
epaggelma:string[30];
tel:string[10];
fax:string[10];
email:string[50];
upeuthinos:string[30];
simeiwseis:string[200];
end;

deiktis= {orizw neo tupo pou periexei ton kwdiko pou einai to kleidi k th thesi ths eggrafis etsi wste na kanw thn taxinomisi}
record
code:string[4];
thesi:integer;
end;

file1=file of eggrafi; {dimiourgia arxeiou tupou eggrafi}
file2=file of deiktis; {dimiourgia arxeiou tupou deiktis}

var {dilwsi katholikwn metablitwn pou xrhsimopoiounati sto programma}
kurio_arxeio:file1;
index_table:file2;
epilogi:integer;
mycode:string[4];
myrec:eggrafi;
pointrec:deiktis;
thesi1:integer;
exit1:boolean;


procedure taxinomisi; {diadikasia opou taxinomountai oi eggrafes me basi to kleidi dld ton kwdiko}
var
xaraktires:string[4];
pinakas:array[1..100] of array[1..2] of integer;
number:integer;
temp1:integer;
temp2:integer;
x1:integer; {metabliti gia thn epanalipsi etsi wste na gemisw to pinaka me 0}
x2:integer; {metabliti pou auksanei k phgainei sthn epomenh thesi tou pinaka}
x3:integer; {metabliti se periptwsh lathous ths sunarthshs val}
sum:integer; {metabliti pou tha periexei to sunolo twn eggrafwn ston index table}
x5:integer;

begin

for x1:= 1 to 100 do {bazw 0 se ola ta pedia tou pinaka}
begin
pinakas[x1][1]:= 0;
pinakas[x1][2]:= 0;
end;

reset(index_table); {me tin entoli reset topothetoume to deikti anagnwsis stin arxh tou index table}
x2 := 1;
repeat {epanalabe mexri na diabaseis olokliro ton index table}
read(index_table, pointrec); {diavase apo to index arxeio tin eggrafi,dld to kwdiko k th thesi}
val(pointrec.code, number, x3); {metetrepse ton kwdiko pou einai string se arithmo kai balton
stin metabliti number}
pinakas[x2][1] := number; {bale tous kwdikous sthn prwth sthlh tou pinaka}
pinakas[x2][2] := pointrec.thesi; {bale tis theseis pou briskontai oi eggrafes sto kurio arxeio sthn deuteri sthlh}
inc(x2); {auksise ti metabliti x2}
until eof(index_table) = true; {epanalabe mexri na teleiwsei to index arxeio}

sum:= 0;

repeat
sum:=sum+1; {auksane th metabliti mexri na diabaseis oles tis eggrafes tou pinaka pou einai diafores apo to 0}
until ((pinakas[sum][1] = 0) and (pinakas[sum][2] = 0));

dec(sum); {meiose tin metabliti sum gia na fthaseis stin teleutea eggrafi tou pinaka}

for x1 := 1 to sum do {epanalabe gia oles tis eggrafes tou pinaka}
for x5 := sum downto x1+1 do {apo tin teleutaia eggrafi pros tin proti eggrafi tou pinaka epanelabe}
begin
if (pinakas[x5-1][1] > pinakas[x5][1]) then {an i texousa thesi einai megaliteri apo tin prohgoumeni
thesi apo autin tote}
begin
temp1:= pinakas[x5-1][1];
temp2:= pinakas[x5-1][2];
pinakas[x5-1][1] := pinakas[x5][1]; {kane antimetathesi auton ton eggrafon}
pinakas[x5-1][2] := pinakas[x5][2]; {etsi oste na taksimonitoun oi eggrafes se auksousa seira}
pinakas[x5][1] := temp1;
pinakas[x5][2] := temp2;

end;
end;

reset(index_table); {bale to deikti stin arxi tou index arxeiou}

for x2:= 1 to sum do {gia oles tis eggrafes tou pinaka}
begin
str(pinakas[x2][1], xaraktires); {matetrepse ton aritmo tis protis stilis stin trexousa thesi se
xaraktires kai bale ton sti metabliti "xaraktires"}
pointrec.code := xaraktires;
pointrec.thesi := pinakas[x2][2]; {gemisma tou pinaka me tis taksinomimenes eggrafes}
write(index_table, pointrec);
end; {telos epanalipsis for}

end; {telos diadikasias taxinomisis}




procedure dimiourgia_eggrafis; {dimiourgia neas eggrafis sto arxeio}
var
iparxon_kodikos:boolean;
x:integer;
y:integer;
z:integer;
imerominia:string[8];
eggiri_imerominia:boolean;

begin
writeln('Sumplirwste ola ta upoxrewtika pedia(*)');
writeln;

repeat {epanelabe}
write('Eisagete kwdiko promitheuth (* 4 xaraktires) :');
{iparxon_kodikos := false; }

readln(myrec.kwdikos); {diabazetai kodikos}
iparxon_kodikos:= false;
reset(index_table); {topotheteitai o deiktis stin arxi tou index table gia
na psaksei an uparxei hdh o kwdikos}
while not eof(index_table) do {oso den exei teleiwsei o pinakas deiktwn epanalabe}
begin
read(index_table, pointrec); {elegxetai an o kodikos pou edwse o xrhsths uparxei hdh sto eurethrio}
if (myrec.kwdikos = pointrec.code) then
begin
iparxon_kodikos:= true;
writeln('O kwdikos promitheuth pou dwsate upaxei hdh. Parakalw dwste allo kwdiko.');
end; {an uparxei o kwdikos hdh emfanizetai sxetiko mnm sto xrhsth}
end;
x:=(length(myrec.kwdikos)); {metrame to plithos twn psifiwn pou edwse o xrhsths gia to kwdiko}
until (myrec.kwdikos <> '')and (x=4)and (iparxon_kodikos = false);
{h epanalipsi stamataei otan o kwdikos einai diaforetikos apo to keno,
einai 4 psifia kai otan den uparxei hdh. prepei na isxuoun kai ta 3 gia na
ginei egkiri eisagwgh kwdikou}

repeat
write('Eisagete thn epwninia tou promhtheuth (*) :');
readln(myrec.eponimia); {diabazetai h epwnimia mexri na dwsei o xrhsths xarakthres}
until (myrec.eponimia <> '');

repeat
write('Eisagete thn odo kai ton arithmo (*) :');
readln(myrec.dieuthinsi); {diabazetai h odos kai o arithmo mexri na dwsei o xrhsths xaraktires}
until (myrec.dieuthinsi <> '');

repeat
write('Eisagete ton taxidromiko kwdika (* 5 xarakthres) :');
readln(myrec.tax_kwd);
y:=(length(myrec.tax_kwd)); {diabazetai o taxidromikos kodikas mexri na dwsei o xrhsths
xaraktires kai to plithos tous na einai iso me 5}
until (myrec.tax_kwd <> '') and (y=5);

repeat
write('Eisagete thn poli (*) :');
readln(myrec.poli); {diabazetai h poli mexri na dwsei o xrhsths xarakthres}
until (myrec.poli <> '');

repeat
write('Eisagete to AFM (* 9 xarakthres):');
readln(myrec.afm);
z:=(length(myrec.afm)) {diabazetai to afm na dwsei o xrhsths xaraktires kai
to plithos tous na einai iso me 9}
until (myrec.afm <> '') and (z=9);

repeat
write('Eisagete thn DOY (*) :');
readln(myrec.doy); {diabazetai h doy mexri na dwsei o xrhsths xaraktires}
until (myrec.doy <> '');

eggiri_imerominia:=true;
repeat
if(eggiri_imerominia=false)then
writeln('Mi eggiri morfi imerominias. Parakalw dwste imerominia ths morfis DD/MM/YY');
write('Eisagete thn imerominia dimiourgias (*) :');
eggiri_imerominia:=true;
readln(imerominia); {diabazetai h hmerominia pou dinei o xrhsths}


if ((imerominia[1] < '0') or (imerominia[1] > '3')) then eggiri_imerominia := false;
{an to 1o psifio ths dd einai <0 h' >3 tote eggiri_imerominia := false }
if ((imerominia[1] = '3') and (imerominia[2] > '1')) then eggiri_imerominia := false;
{elegxos etsi wste to dd na ftanei mexri 31}
if ((imerominia[2] < '0') or (imerominia[2] > '9')) then eggiri_imerominia := false;
if ((imerominia[4] < '0') or (imerominia[4] > '1')) then eggiri_imerominia := false;
if ((imerominia[4] = '1') and (imerominia[5] > '2')) then eggiri_imerominia := false;
if ((imerominia[5] < '0') or (imerominia[5] > '9')) then eggiri_imerominia := false;
{elegxoi etsi wste to mm na ftanei mexri 12}
if ((imerominia[7] < '0') or (imerominia[7] > '9')) then eggiri_imerominia := false;
if ((imerominia[8] < '0') or (imerominia[8] > '9')) then eggiri_imerominia := false;
{elegxoi etsi wste to yy n aftane mexri 99}
if ((imerominia[3] <> '/') or (imerominia[6] <> '/')) then eggiri_imerominia := false;
{periorismos etsi wste sth thesi 3 k 6 tou string hmerominia na einai to sumbolo "/"}
until(eggiri_imerominia=true);
myrec.hmerominia:=imerominia;

repeat
write('Eisagete thn apografi(*) :');
readln(myrec.apografi); {diabazetai h apografi mexri na dwsei o xrhsths timi megaliteri ;h isi tou 0}
until (myrec.apografi>=0);

repeat
write('Eisagete thn sinoliki xrewsi (*) :');
readln(myrec.sinoliki_xrewsi); {diabazetai h sinoliki xrewsi mexri na dwsei o xrhsths timi megaliteri ;h isi tou 0}
until (myrec.sinoliki_xrewsi>=0);

repeat
write('Eisagete thn sinoliki pistwsi (*) :');
readln(myrec.sinoliki_pistwsi); {diabazetai h sinoloki pistwsi mexri na dwsei o xrhsths timi megaliteri ;h isi tou 0}
until (myrec.sinoliki_pistwsi>=0);



write('Eisagete to epaggelma :');
readln(myrec.epaggelma); {diabazetai to epaggelma}

write('Eisagete to thlefwno :');
readln(myrec.tel); {diabazetai to thlefwno}

write('Eisagete to fax :');
readln(myrec.fax); {diabazetai to fax}

write('Eisagete to e-mail :');
readln(myrec.email); {diabazetai to email}

write('Eisagete to onomatepwnimo tou upeuthinou:');
readln(myrec.upeuthinos); {diabazetai to onomatepwnimo tou upeuthinou}

write('Eisagete kapoia shmeiwsi:');
readln(myrec.simeiwseis); {diabazetai simeiwsi}


mycode:=myrec.kwdikos;
seek(kurio_arxeio,filesize(kurio_arxeio)); {mpainei h eggrafi pou dhmiourgeitai sto telos tou kuriou arxeiou}
write(kurio_arxeio,myrec); {me thn entoli seek bazoume to deikti sto shmeio tou arxeiou pou tou leme me th 2i parametro
h filesize sunarthsh dinei to megethos tou arxeiou}

pointrec.code:=mycode;
pointrec.thesi:=thesi1;


reset(index_table);
seek(index_table,filesize(index_table)); {bazoume to deikti sto telos tou index}
write(index_table,pointrec); {bazoume to kwdiko sto telos tou index}

inc(thesi1); {auksanw th metabliti thesi1}

end; {telos diadikasias}



procedure proboli_eggrafis; {diadikasia probolis eggrafwn pou uparxoun sto kurio arxeio}
var
ipolipo:integer; {topiki metabliti pou xrisimopoieitai mono sti procedure}
begin
reset(index_table); {topotheteitai o deiktis stin arxi tou index}
while not eof (index_table) do {oso dn exei teleiwsei to index epanalabe}
begin
clrscr;
read(index_table,pointrec); {diavase ton kwdiko apo to index}
reset(kurio_arxeio); {bale to deikti stin arxi tou kuriou arxeiou}
if not (pointrec.code = '0') then {an o kodikos den einai 0}
begin {tote emfanizetai h eggrafi sthn othoni}

seek(kurio_arxeio,pointrec.thesi - 1);
read(kurio_arxeio,myrec);
writeln;
writeln('Kwdikos promitheuti : ',myrec.kwdikos);
writeln('Epwnimia promitheuti : ',myrec.eponimia);
writeln('Odos & arithmos : ',myrec.dieuthinsi);
writeln('Poli : ',myrec.poli);
writeln('Taxidromikos kwdikas : ',myrec.tax_kwd);
writeln('AFM : ',myrec.afm);
writeln('DOY : ',myrec.doy);
writeln('Hmerominia ghmiourgias : ',myrec.hmerominia);
writeln('Apografi : ',myrec.apografi);
writeln('Sunoliki xrewsi : ',myrec.sinoliki_xrewsi);
writeln('Sunoliki pistwsi : ',myrec.sinoliki_pistwsi);

ipolipo:=myrec.apografi - myrec.sinoliki_xrewsi + myrec.sinoliki_pistwsi;
writeln('Ypoloipo : ',ipolipo);
{upologizetai to upoloipo tou promhtheuth k emfanizetai}
writeln('Epagelma : ',myrec.epaggelma);
writeln('Tilephono : ',myrec.tel);
writeln('Fax : ',myrec.fax);
writeln('E-mail : ',myrec.email);
writeln('Onomatepwnimo ypeuthinou : ',myrec.upeuthinos);
writeln('Simeiwseis : ',myrec.simeiwseis);

writeln('Gia anazithis kapoias allis eggrafis patiste kapio pliktro');
readkey;
writeln;
end;
end;
end; {telos diadikasias emfanisis eggrafwn}



procedure proboli_diastimatos; {diadikasias probolis eggrafwn
mesa se ena diastima pou dinei o xrhsths}
var {topikes metablites pou xrisimopoiuntai sth procedure}
pointer1:integer;
number:integer;
x:integer;
katw_diastima:integer;
panw_diastima:integer;
ipolipo:integer;
begin
reset(index_table);
pointer1:=1;
katw_diastima:=0;
panw_diastima:=0;

repeat
write('Dwste katw diasthma : ');
read(katw_diastima); {diabazetai to katw diastima}
write('Dwste panw diastima : ');
read(panw_diastima); {diabazetai to panw diastima}
if(panw_diastima < katw_diastima) then
writeln('Lathos diastimata. Dwste ksana swsta diastimata');
until (katw_diastima < panw_diastima); {mexri to katw diatima na einai mikrotero apo to panw}
clrscr;
repeat
read(index_table,pointrec);
val(pointrec.code,number,x); {metatrepw to code pou einai string se arithmo k to bazw sto number}
if(number >= katw_diastima)and(number <= panw_diastima)then {oso o kodikos brisketai
sto diastima pou edwse o xristis emfanizontai oi eggrafes}
begin {proboli eggrafwn}
reset(kurio_arxeio);
seek(kurio_arxeio,pointrec.thesi - 1);
read(kurio_arxeio,myrec);
writeln;
writeln('Kwdikos promitheuti : ',myrec.kwdikos);
writeln('Epwnimia promitheuti : ',myrec.eponimia);
writeln('Odos & arithmos : ',myrec.dieuthinsi);
writeln('Poli : ',myrec.poli);
writeln('Taxidromikos kwdikas : ',myrec.tax_kwd);
writeln('AFM : ',myrec.afm);
writeln('DOY : ',myrec.doy);
writeln('Hmerominia ghmiourgias : ',myrec.hmerominia);
writeln('Apografi : ',myrec.apografi);
writeln('Sunoliki xrewsi : ',myrec.sinoliki_xrewsi);
writeln('Sunoliki pistwsi : ',myrec.sinoliki_pistwsi);

ipolipo:=myrec.apografi - myrec.sinoliki_xrewsi + myrec.sinoliki_pistwsi;
writeln('Ypoloipo : ',ipolipo);
{upologizetai to upoloipo tou promhtheuth k emfanizetai}
writeln('Epagelma : ',myrec.epaggelma);
writeln('Tilephono : ',myrec.tel);
writeln('Fax : ',myrec.fax);
writeln('E-mail : ',myrec.email);
writeln('Onomatepwnimo ypeuthinou : ',myrec.upeuthinos);
writeln('Simeiwseis : ',myrec.simeiwseis);

writeln('Gia anazithis kapoias allis eggrafis patiste kapio pliktro');
readkey;
writeln;

inc(pointer1);
end;
until (eof(index_table)=true); {mexri na teleiwsei to index arxeio}
end; {telos diadikasias probolis diastimatos eggrafon}



procedure metaboli_eggrafis; {diadikasia metabolis mias eggrafis}
var {topikes metablites pou xrisimopoiuntai sth procedure}
number:integer;
y:integer;
z:integer;
w:integer;
code1:integer;
eggiri_imerominia:boolean;
x:boolean;
imerominia:string[8];

begin
write('Eisagete ton kwdiko tou promhtheuth pou thelete na allaksete: ');
readln(code1); {diabazetai o kwdikos pou thelei o xristis na allaksei}
reset(index_table); {topotetheitai o deiktis stin arxi tou index arxeiou}
repeat {enelalabe}
read(index_table,pointrec); {diabasai kwdiko ap'to index arxeio}
val(pointrec.code,number,y); {metetrepse ton kwdiko apo string se aritmo k balto sto number}
x:=false;
if(number=code1)then {an o kodikos pou pou edwse o xrhsths einai idios me auton pou phrame apo to index tote}
begin
x:=true;
reset(kurio_arxeio);
seek(kurio_arxeio,pointrec.thesi - 1); {emfanizetai plaisio pou zitaei nea stoixeia gia thn eggrafi}
read(kurio_arxeio,myrec);

repeat {oso uparxoun eggrafes sto indexarxeio}
write('Eisagete nea epwnimia (*) :');
readln(myrec.eponimia);
until (myrec.eponimia<>'');

repeat
write('Eisagete nea odo kai arithmo (*) :');
readln(myrec.dieuthinsi);
until (myrec.dieuthinsi<>'');

repeat
write('Eisagete neo taxidromiko kwdika (* 5 xaraktires) :');
readln(myrec.tax_kwd);
w:=(length(myrec.tax_kwd)); {diabazetai o taxidromikos kodikas mexri na dwsei o xrhsths 5 xarakthres}
until (myrec.tax_kwd <> '') and (w=5);

repeat
write('Eisagete nea poli (*) :');
readln(myrec.poli);
until (myrec.poli<>' ');

repeat
write('Eisagete neo AFM (* 9 xarakthres):');
readln(myrec.afm);
z:=(length(myrec.afm)) {diabazetai to afm mexri na dwsei o xrhsths 9 xarakthres}
until (myrec.afm <> '') and (z=9);

repeat
write('Eisagete nea DOY (*) :');
readln(myrec.doy);
until (myrec.doy<>' ');

eggiri_imerominia:=true;
repeat
if(eggiri_imerominia=false)then
writeln('Mi eggiri morfi imerominias. Parakalw dwste imerominia ths morfis DD/MM/YY');
write('Eisagete thn nea imerominia dimiourgias (*) :');
eggiri_imerominia:=true;
readln(imerominia); {diabazetai h hmerominia pou dinei o xrhsths}


if ((imerominia[1] < '0') or (imerominia[1] > '3')) then eggiri_imerominia := false;
{an to 1o psifio ths dd einai <0 h' >3 tote eggiri_imerominia := false }
if ((imerominia[1] = '3') and (imerominia[2] > '1')) then eggiri_imerominia := false;
{elegxos etsi wste to dd na ftanei mexri 31}
if ((imerominia[2] < '0') or (imerominia[2] > '9')) then eggiri_imerominia := false;
if ((imerominia[4] < '0') or (imerominia[4] > '1')) then eggiri_imerominia := false;
if ((imerominia[4] = '1') and (imerominia[5] > '2')) then eggiri_imerominia := false;
if ((imerominia[5] < '0') or (imerominia[5] > '9')) then eggiri_imerominia := false;
{elegxoi etsi wste to mm na ftanei mexri 12}
if ((imerominia[7] < '0') or (imerominia[7] > '9')) then eggiri_imerominia := false;
if ((imerominia[8] < '0') or (imerominia[8] > '9')) then eggiri_imerominia := false;
{elegxoi etsi wste to yy n aftane mexri 99}
if ((imerominia[3] <> '/') or (imerominia[6] <> '/')) then eggiri_imerominia := false;
{periorismos etsi wste sth thesi 3 k 6 tou string hmerominia na einai to sumbolo "/"}
until(eggiri_imerominia=true);
myrec.hmerominia:=imerominia;
repeat
write('Eisagete thn nea apografi(*) :');
readln(myrec.apografi);
until (myrec.apografi>=0);

repeat
write('Eisagete th nea sinoliki xrewsi (*) :');
readln(myrec.sinoliki_xrewsi);
until (myrec.sinoliki_xrewsi>=0);

repeat
write('Eisagete th nea sinoloki pistwsi (*) :');
readln(myrec.sinoliki_pistwsi);
until (myrec.sinoliki_pistwsi>=0);

write('Eisagete to neo epaggelma :');
readln(myrec.epaggelma);

write('Eisagete to neo thlephono :');
readln(myrec.tel);

write('Eisagete to neo fax :');
readln(myrec.fax);

write('Eisagete to neo e-mail :');
readln(myrec.email);

write('Eisagete to neo onomatepwnilo tou upeuthinou:');
readln(myrec.upeuthinos);

write('Eisagete kapoia nea simeiwsi:');
readln(myrec.simeiwseis);

seek(kurio_arxeio,filepos(kurio_arxeio) - 1);
write(kurio_arxeio,myrec);
end;
until eof(index_table);
if (x=false) then {an o kodikos pou pirame apo to voithitiko arxeio
den einai idios me ton kodiko pou edose o xristis tote}
writeln('O kwdikos pou dwsate den uparxei'); {emfanizetai mnm oti o kwdikos den iparxei}
end; {telos diadikasias metabolis kapoias eggrafis}


procedure diagrafi_eggrafis; {diadikasias diagrafis kapoias iparxousas eggrafis}
var {topikes metablites pou xrisimopoiuntai sth procedure}
code1:integer;
number:integer;
y:integer;
x:boolean;

begin
write('Eisagete ton kwdiko tou promitheuth pou thelete na diagrafei : ');
reset(index_table); {topotheteitai o deiktis stin arxi tou index arxeiou}
read(code1); {diabazetai o kwdikos pou o xristis thelei na diagrapsei}
x:=false;
while (not eof(index_table)) do {oso iparxoun eggrafes sto index_table epanalabe}
begin
read(index_table,pointrec); {pare enan enan kwdiko apo to index arxeio}
val(pointrec.code,number,y); {matetrepse ton kwdiko apo xaraktires se arithmo}
x:=false;
if(number=code1) then {an o kodikos pou edose o xrhsths gia diagrafi einai idios
me auton pou deixnei o deiktis sto index arxeio}
begin
x:=true;
seek(index_table,filepos(index_table) - 1);
pointrec.code:='0'; {tote bale ston kodiko tin timi "0". Bazvntas 0 to diagrafoume afou den einai 4psifios}
write(index_table,pointrec); {enimeronetai to index arxeio gia ti diagrafi}
end;
end;
if(x=false) then {an o kodikos pou edose o xrhsths gia diagrafi den einai idios
me auton pou deixnei o deiktis sto index arxeio tote}
writeln('O kwdikos pou thelete na diagrafei den uparxei ');{emfanizetai mnm oti o kodikos den iparxei}
end;


{kurio programma}
begin {arxi kurios programmatos}

assign(kurio_arxeio, 'c:\suppliers.dat'); {sundeoume th metabliti kurio arxeio me to arxeio suppliers.dat}
assign(index_table, 'c:\index.dat'); {sindeoume th metablith index_table me to arxeio index.dat}



reset(kurio_arxeio);
if (IOResult <> 0) then rewrite(kurio_arxeio);
reset(index_table);
if (IOResult <> 0) then rewrite(index_table);

thesi1 := filesize(kurio_arxeio) + 1;

repeat
if (filesize(kurio_arxeio)) > 2 then taxinomisi;


repeat {emfanisi kurios menou}
writeln('--------MENU:--------');
writeln('1--> Dimiourgia neas eggrafis');
writeln('2--> Proboli eggrafis');
writeln('3--> Proboli eggrafwn se diastima pou dinei o xristis');
writeln('4--> Metaboli eggrafis');
writeln('5--> Diagrafi eggrafis');
writeln('6--> Exit');

write('Dste mia epilogi :'); {diabazetai epilogi mexri na dothei eggiri epilogi(1-6)}
readln(epilogi);
until (epilogi >= 1) and (epilogi <= 6);

case epilogi of
1:
begin
dimiourgia_eggrafis; {epilogi 1 gia dimiourgia neas eggrafis}
end;

2:
begin
proboli_eggrafis; {epilogi 2 gia proboli ton eggrafon pou iparxoun sto arxeio}
end;

3:
begin
proboli_diastimatos; {epilogi 3 gia na emfanistoun eggrafes metaksi
tou diastimatos pou dinete apo to xristi}
end;

4:
begin
metaboli_eggrafis; {epilogi 4 gia tropopoiisi kapoias eggrafis}
end;

5:
begin
diagrafi_eggrafis; {epilogi 5 gia diagrafi kapoias eggrafis}
end;

6:
begin
exit1:= true; {epilogi 6 gia eksodo apo to programma}
end;

end;

until (exit1 = true);

close(kurio_arxeio); {kleisimo kuriou arxeiou}
close(index_table); {kleisimo index arxeiou}

end. {telos programmatos}>

Report
Re: no way to get the console handle Posted by Atex on 10 Jun 2009 at 6:12 PM
Turn I/O checking off by using the {$I-} directive ( as your first line to act globally ), otherwise the ioresult wont get executed, your program will stop before at the first unsuccessful file operation with an error code. This most likely will fix your isssue... My FPC ( BTW, Dev Pascal runs on FPC ) reported runtime error 2 with your code, meaning: "File not found: Reported when trying to erase, rename or open a non-existent file." Don't use < and > to post a code, here's the info how to do: http://www.programmersheaven.com/2/PH-Rendering-Guide



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.