Qbasicnews.com
April 12, 2021, 06:28:05 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: File INPUT/OUTPUT  (Read 8037 times)
Anonymous
Guest
« Reply #15 on: April 04, 2006, 03:07:37 PM »

once again, i am silenced by the experts..
Logged
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #16 on: April 04, 2006, 04:04:36 PM »

Quote from: "axipher"
If you don't want freefile then number each file from #1 and up for your program, then but another number in front of that one so you would end up with 11,12,13 or 421,422,423 etc.
WTF? What opens 423 files from one app? Maybe an OS?
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
axipher
Ancient Guru
****
Posts: 544



« Reply #17 on: April 04, 2006, 09:14:07 PM »

No, not actually openeing 423 files, just opening that file as #423, to prevent opening 2 or more files with same number
Logged
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #18 on: April 04, 2006, 09:22:57 PM »

If everybody used that, it would be useless.
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Anonymous
Guest
« Reply #19 on: April 05, 2006, 07:12:21 AM »

i just looked to see if you were right, you arent. fb calls a runtime function when using freefile, so when you compile a binary, it is still
important to have used FREEFILE.


Code:
? "hello"
Dim As Integer f
f = FreeFile

becomes
Code:
.intel_syntax noprefix

#sda.bas' compilation started at 05:07:05 (FreeBASIC v0.16b)

.section .text
.balign 16

.globl _main
_main:
push ebp
mov ebp, esp
and esp, 0xFFFFFFF0
sub esp, 8
mov dword ptr [ebp-8], 0
mov dword ptr [ebp-4], 0
call ___main
push dword ptr [ebp+12]
push dword ptr [ebp+8]
call _fb_Init@8
.Lt_0001:
push 1
push 5
push offset Lt_0003
call _fb_StrAllocTempDescZEx@8
push eax
push 0
call _fb_PrintString@12
call _fb_FileFree@0 ;<--- I keep your app from puking under unexpected conditions
mov dword ptr [ebp-8], eax
.Lt_0002:
push 0
call _fb_End@4
mov eax, dword ptr [ebp-4]
mov esp, ebp
pop ebp
ret
#sda.bas' compilation took 1.825374210980613e-003 secs
#global initialized constants

.section .data
.balign 16
.balign 4
Lt_0003: .ascii "hello\0"
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #20 on: April 05, 2006, 07:30:24 AM »

It's not that hard, just remember to call FREEFILE right before OPEN, _always_. That way, no probs.

Code:
f = FreeFile
Open "superpussy.jpg" For Binary As #f


Always, always tied. And no probs.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
axipher
Ancient Guru
****
Posts: 544



« Reply #21 on: April 05, 2006, 08:52:22 AM »

Quote from: "na_th_an"
It's not that hard, just remember to call FREEFILE right before OPEN, _always_. That way, no probs.

Code:
f = FreeFile
Open "superpussy.jpg" For Binary As #f


Always, always tied. And no probs.


Or remember to OPEN the file right after you use FREEFILE.
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #22 on: April 05, 2006, 10:26:47 AM »

Now I realize the incredible pun (not intended, I promise) which lies in the tiny code piece of my last post.

:lol:
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #23 on: April 05, 2006, 12:10:15 PM »

What pun? All that code piece does is confirm your status as a horny Spaniard. :wink:
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!