[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2005-10-19T14:18:05-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/1080 2005-10-19T14:18:05-05:00 2005-10-19T14:18:05-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8544#p8544 <![CDATA[check for file existence and then condition statement]]>
In the ugly and powerless batch scripting language of DOS and W9x, zero length files were used by the more 1337 programmers to overcome the limitations of the language.
Zero length files made good flags. And I remember a way to separe a file name from its extension using a dummy file and REN...

I must add those files were duly erased before the .BAT file ended.
Antoni, I agree with most of what you say, but consider the following. ERRORLEVEL codes are the most common flags used for communicating between programs and batchfiles, although many programmers are not familiar with generating these errorlevel codes. For example, if you use a batchfile to compile your QuickBasic programs, you can do "IF ERRORLEVEL 1" after the BC (compiler) to test for any compile errors and avoid doing the LINK.

A batchfile can invoke a program and test for an ERRORLEVEL, but a subsecuent program cannot. So, if someone wrote a program that needed to communicate something like "got an error" to the next program, he could use a zero-length-file as a flag or switch.

Yes, these zero-level-files should be duly erased after being tested, but in many instances they are not, and appear in the user's directory.
*****

Statistics: Posted by moneo — Wed Oct 19, 2005 2:18 pm


]]>
2005-10-19T12:41:33-05:00 2005-10-19T12:41:33-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8537#p8537 <![CDATA[check for file existence and then condition statement]]>
matt

Statistics: Posted by Guest — Wed Oct 19, 2005 12:41 pm


]]>
2005-10-19T10:38:08-05:00 2005-10-19T10:38:08-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8535#p8535 <![CDATA[check for file existence and then condition statement]]> Zero length files made good flags. And I remember a way to separe a file name from its extension using a dummy file and REN...

I must add those files were duly erased before the .BAT file ended.

Statistics: Posted by Antoni — Wed Oct 19, 2005 10:38 am


]]>
2005-10-19T08:05:06-05:00 2005-10-19T08:05:06-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8531#p8531 <![CDATA[check for file existence and then condition statement]]>
Program1 for example would perform it's task...once it was done it would create a zero length file just so that program 2 would know it was now time (by finding that file in that folder) to start performing it's task. for example. I remember hearing that reason quite often. Today you can do that with task handling...but back then, when these files were used, inter process communication either didn't exist or no one knew how to use them efficiently so they did this instead. but I think they didn't exist period back then. :-).

Statistics: Posted by MystikShadows — Wed Oct 19, 2005 8:05 am


]]>
2005-10-19T07:38:08-05:00 2005-10-19T07:38:08-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8530#p8530 <![CDATA[check for file existence and then condition statement]]>
What kind of programs zero length files/is there a stanard practice for implimenting them (eg. .zlf or some shit like that?).

In otherwords: Is it common practice to generate .bmp/.txt/.mpeg(you know, standard file extention) zero length files?

or is it more like any unusual file extension/lack thereof...

Or is there a naming system (like 000.000 )?

matt

Statistics: Posted by Guest — Wed Oct 19, 2005 7:38 am


]]>
2005-10-18T19:36:09-05:00 2005-10-18T19:36:09-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8527#p8527 <![CDATA[check for file existence and then condition statement]]>

Code:

OPEN "C:\myfile.txt" FOR APPEND AS #1IF NOT LOF(1) = 0 THEN PRINT #1, "HI this is a LINE lol IM 1337! not"CLOSE #1OPEN "C:\windows\mespecial.txt" FOR APPEND AS #1IF NOT LOF(1) = 0 THEN PRINT #1, "hEhEhEhE! im specialer than that 1337 guy!"
untested, but should work....
Excellent, Nath. I think that's what cryptid wants.
However, there is a little suble difference between how his batchfile works and your code. If either file was a zero-length-file, the batchfile would treat it as existing, and append a record. In your code, if either file was zero-length, your code would not append a record. I don't think he cares about zero-length-files, so your solution will work fine.


NOTE: You other guys may want to notice that the LOF function is not only for files opened as binary. The manual says: "When a file is opened in any mode, the LOF function returns the size of the file in bytes." I tried it and it works.
*****

Statistics: Posted by moneo — Tue Oct 18, 2005 7:36 pm


]]>
2005-10-18T16:48:49-05:00 2005-10-18T16:48:49-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8525#p8525 <![CDATA[check for file existence and then condition statement]]>

Code:

OPEN "C:\myfile.txt" FOR APPEND AS #1IF NOT LOF(1) = 0 THEN PRINT #1, "HI this is a LINE lol IM 1337! not"CLOSE #1OPEN "C:\windows\mespecial.txt" FOR APPEND AS #1IF NOT LOF(1) = 0 THEN PRINT #1, "hEhEhEhE! im specialer than that 1337 guy!"
untested, but should work. been so long since I did anything with files...

Statistics: Posted by {Nathan} — Tue Oct 18, 2005 4:48 pm


]]>
2005-10-18T14:13:08-05:00 2005-10-18T14:13:08-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8520#p8520 <![CDATA[check for file existence and then condition statement]]>
easy.

Code:

SHELL "yourbatchfilegoeshere.bat"
well i know i can use shell but i want the program to be 100% Qbasic i dont want to generate batch files( i feel it is a bit messy) so can the same batch file be translated into QBasic i mean translate the above batch file to QB code

Statistics: Posted by cryptid — Tue Oct 18, 2005 2:13 pm


]]>
2005-10-18T13:58:28-05:00 2005-10-18T13:58:28-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8518#p8518 <![CDATA[check for file existence and then condition statement]]>

Code:

SHELL "yourbatchfilegoeshere.bat"

Statistics: Posted by {Nathan} — Tue Oct 18, 2005 1:58 pm


]]>
2005-10-18T09:59:50-05:00 2005-10-18T09:59:50-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8515#p8515 <![CDATA[sorry]]> i know how it is done in Batch:
======================================
if exist "C:\myfile.txt" goto append
if exist "C:\WiNDOWS\myfile.txt" goto appendix

:append
Echo Hi this lineis being putin by cryptid>>C:\myfile.txt
exit

:append1
Echo hahahahahahahahahahahahahaha>>C:\WINDOWS\myfile.txt
exit
======================================
So now how i do the same in Qbasic

Statistics: Posted by cryptid — Tue Oct 18, 2005 9:59 am


]]>
2005-10-16T18:39:17-05:00 2005-10-16T18:39:17-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8473#p8473 <![CDATA[check for file existence and then condition statement]]>
no space? Actually, the file name and the recognition in the file system takes up space... so it DOES take up space, just very little...
Read my lips: "no space in the user's directory."
*****

Statistics: Posted by moneo — Sun Oct 16, 2005 6:39 pm


]]>
2005-10-16T14:55:06-05:00 2005-10-16T14:55:06-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8466#p8466 <![CDATA[check for file existence and then condition statement]]> Statistics: Posted by {Nathan} — Sun Oct 16, 2005 2:55 pm


]]>
2005-10-16T13:12:02-05:00 2005-10-16T13:12:02-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8463#p8463 <![CDATA[check for file existence and then condition statement]]>
Nek, it removes 0 lenght files, bad practice.. use DIR$() instead..
1. 0-length files have zero purpose in a user program, and are otherwise pointless. Anyone who uses 0-length files is a moron and anyone who feels a need to retain 0-length files is an equal moron.
2. ....
Nek, You're entitled to your opinion regarding zero-length-files, and in general you may be right. However, traditionally these have been used as "switch" files to communicate between one program and another or between programs and batchfiles. These zero-length-files occupy no space in the user's directory and can easily be tested for their existence.
*****

Statistics: Posted by moneo — Sun Oct 16, 2005 1:12 pm


]]>
2005-10-16T12:51:39-05:00 2005-10-16T12:51:39-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8462#p8462 <![CDATA[check for file existence and then condition statement]]>
fork you.
Oh.. you.. :oops: :D

Statistics: Posted by Z!re — Sun Oct 16, 2005 12:51 pm


]]>
2005-10-16T12:13:54-05:00 2005-10-16T12:13:54-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=8461#p8461 <![CDATA[check for file existence and then condition statement]]>

Code:

Function _MOUSEX ( Pathname As String ) As Integer   Dim FF As Integer   FF = FreeFile   On Error Goto No_File   Open Pathname For Input As #FF   Close #FF   _MOUSEX = 1   Exit FunctionNo_File:   Is_Exist = 0End Function

Statistics: Posted by Guest — Sun Oct 16, 2005 12:13 pm


]]>