English
Source / code snippets

Fclose Fopen

 
I see means should one real XProfan10 fopen/fclose so looks:
CompileMarkSeparation
proc fopen

    parameters fle$,mode$
    declare h&
    h&=assign(fle$)

    if mode$="r"

        reset h&

    elseif mode$="w"

        rewrite h&

    elseif mode$="a"

        append h&

    elseif mode$="b"

        openrw h&

    endif

    return h&

endproc

proc fclose

    parameters h&
    close h&
    assign h&,""

endproc

?
 
05/02/06  
 




Michael
Wodrich
Yes, then ists clear. and with iFs drumherum-functions go itself too The C-Indianer here well feel.

though can To foot program one further Assign with obigem Example of Roland entfallen.

the a is well for further edit, the others is well for sofortige lever-release.

thanks
Best wishes
Michael Wodrich
 
Programmieren, das spannendste Detektivspiel der Welt.
05/02/06  
 




RGH
[quote:4504e32796=iF]I see means should one real fopen/fclose so looks: ...[/quote:4504e32796]
correctly!
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
05/02/06  
 




H.Brill
Irgendwas shining but not spare given To go.
at that renewed write in a with OpenRW opened
File, is the last DS twice drin, if The To schreibenden
data less are. means instead of 3 DS only yet 2 drin stand should.
Declare Long File, Memory were[]
Set("Decimals", 2)
Struct item = name$(30), Price!
Dim were[], item
SetSize were[], 3
File = Assign($PROGDIR + "Waren.dat")
OpenRW File

With were[0]

    were[0].name$ = "Milch"
    were[0].Price! = 0.99

EndWith

With were[1]

    were[1].name$ = "Butter"
    were[1].Price! = 2.25

EndWith

With were[2]

    were[2].name$ = "Käse"
    were[2].Price! = 3.55

EndWith

Print "\nAus the aray red :"
AusgabeArray()
Save()
Print "\nTaste for Dateiausgabe..."
WaitKey
spending()
Print "\nDelete set Nr. 2 in Datei"
WaitKey
Arrdel were[], 1, 1
Print "\nAusgabe aray to ArrDel"
Waitkey
AusgabeArray()
Save()
Print "\nNach Save the new File."
spending()
WaitKey

Proc Save

    Declare Long offset
    Assign #1, $PROGDIR + "Waren.dat"
    Erase #1
    Close #1
    Assign #1, ""
    Assign #1, $PROGDIR + "Waren.dat"
    OpenRW #1
    offset = 0

    WhileLoop 0, SizeOf(were[]) - 1

        BlockWrite #1, were[&LOOP]
        Inc offset, 35

    EndWhile

    Close #1
    Assign #1, ""

ENDPROC

Proc spending

    Declare Long Records
    Assign #1, $PROGDIR + "Waren.dat"
    OpenRW #1
    Records = GetFileSize(#1) / 34
    Clear were[]
    SetSize were[], Records
    Seek #1, 0

    WhileLoop 0, Records - 1

        BlockRead(#1, were[&LOOP], 0, SizeOf(were[&LOOP]))

        With were[&LOOP]

            Print "Artikel :", .name$, "Preis : ", .Price!

        EndWith

    EndWhile

    Close #1
    Assign #1, ""

ENDPROC

Proc AusgabeArray

    WhileLoop 0, SizeOf(were[]) - 1

        With were[&LOOP]

            Print "Artikel : ", were[&LOOP].name$, "Preis :", were[&LOOP].Price!

        EndWith

    EndWhile

    Save()

ENDPROC

End

shining so, as would one profaninterner Speicherbereich, the not or
not entire reset watts, involved. The File Yes to
the renewed write deleted.
ArrDel functions time anyway correctly..
what me yet noticed is : first, if I The File with the Explorer
gänzlich deleted have, are too The remains of Dateiende disappeared.
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
11/29/23  
 




Georg
Teles
Nabend,

look time in line 7, füge simply time to OpenRW File

as long as The File "doppelt geöffnet" is, shining XProfan The old Filesize of 177 Bytes instead of new 78 auszulesen, because these blocked is, so becomes tappt im dunkeln too with Erase not deleted, therefore verzwickt itself the

then works

your whole code:
Declare Long File, Memory were[]
Set("Decimals", 2)
Struct item = name$(30), Price!
Dim were[], item
SetSize were[], 3
File = Assign($PROGDIR + "Waren.dat")
OpenRW File
Close File

With were[0]

    were[0].name$ = "Milch"
    were[0].Price! = 0.99

EndWith

With were[1]

    were[1].name$ = "Butter"
    were[1].Price! = 2.25

EndWith

With were[2]

    were[2].name$ = "Käse"
    were[2].Price! = 3.55

EndWith

Print "\nAus the aray red :"
AusgabeArray()
Save()
Print "\nTaste for Dateiausgabe..."
WaitKey
spending()
Print "\nDelete set Nr. 2 in Datei"
WaitKey
Arrdel were[], 1, 1
Print "\nAusgabe aray to ArrDel"
Waitkey
AusgabeArray()
Save()
Print "\nNach Save the new File."
spending()
WaitKey

Proc Save

    Declare Long offset
    Assign #1, $PROGDIR + "Waren.dat"
    Erase #1
    Close #1
    Assign #1, ""
    Assign #1, $PROGDIR + "Waren.dat"
    OpenRW #1
    offset = 0

    WhileLoop 0, SizeOf(were[]) - 1

        BlockWrite #1, were[&LOOP]
        Inc offset, 35

    EndWhile

    Close #1
    Assign #1, ""

ENDPROC

Proc spending

    Declare Long Records
    Assign #1, $PROGDIR + "Waren.dat"
    OpenRW #1
    Records = GetFileSize(#1) / 34
    Clear were[]
    SetSize were[], Records
    Seek #1, 0

    WhileLoop 0, Records - 1

        BlockRead(#1, were[&LOOP], 0, SizeOf(were[&LOOP]))

        With were[&LOOP]

            Print "Artikel :", .name$, "Preis : ", .Price!

        EndWith

    EndWhile

    Close #1
    Assign #1, ""

ENDPROC

Proc AusgabeArray

    WhileLoop 0, SizeOf(were[]) - 1

        With were[&LOOP]

            Print "Artikel : ", were[&LOOP].name$, "Preis :", were[&LOOP].Price!

        EndWith

    EndWhile

    Save()

ENDPROC

End

Regards
Georg
 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

11/30/23  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

3.167 Views

Untitledvor 0 min.
E.T. vor 22 Tagen
Jens-Arne Reumschüssel07/05/24
GDL05/22/24
Thomas Freier01/06/24
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie