Recent Posts

Pages: 1 2 3 [4] 5 6 ... 10
31
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by bplus on April 14, 2022, 07:05:05 pm »
I would use a shell command to delete files with wildcards.

32
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by hanness on April 14, 2022, 02:51:20 pm »
Thanks for the suggestions. My example was simplified. The actual files in questions and not straight incrementing serial numbers. They actually contain a version number. Here is an example:

WIM_TOOLS_5.1.1.100.txt

I just tried my little fake file idea, and it works perfectly.

Funny, I was stumped by this for 2 hours. 2 minutes after I posted my question that idea spring into my head.
33
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by RhoSigma on April 14, 2022, 02:42:47 pm »
Actually, I think that I just figured out a little kludge of a workaround.

Before executing the kill command, simply create a fake file called Trash0.txt. That guarantees a file of the format Trash*.txt exists and that will prevent the kill command from throwing an error.

Of course, easy workaround, if it's ok for you to create a file just to immediately delete it again.
34
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by RhoSigma on April 14, 2022, 02:40:06 pm »
Code: QB64: [Select]
  1. For n% = 0 To 1000 'change if you expect more files
  2.     f$ = "Trash" + LTrim$(Str$(n%)) + ".txt"
  3.     If _FileExists(f$) Then Kill f$
  4. Next n%
  5.  
35
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by hanness on April 14, 2022, 02:39:32 pm »
Actually, I think that I just figured out a little kludge of a workaround.

Before executing the kill command, simply create a fake file called Trash0.txt. That guarantees a file of the format Trash*.txt exists and that will prevent the kill command from throwing an error.
36
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by Cobalt on April 14, 2022, 02:39:16 pm »
_FILEEXISTS isn't supposed to accept wildcards. Its purpose is to check if a specific file exists. if you need to check if a series of files exists then you will either need to make a loop that iterates through the total possible instances of a specific file, say if TRASH0000.TXT to TRASH9999.TXT was the naming convention. Otherwise you will need to probably look into a SHELL style command or some form of API call.
37
QB64 Discussion / _FileExists not working with wildcards
« Last post by hanness on April 14, 2022, 02:25:08 pm »
I'm having a problem with _FileExists. It seems like this function does not handle wildcards.

My goal here is to see if there are any files in the same folder where the program is located named Trash1,txt, Trash2.txt, Trash3.txt, etc.

Take this as an example:

If _FileExists("Trash*.txt") Then
    Kill "Trash*.txt"
End If

The above program would fail to delete those files because _FileExists appears to be unable to handle wildcards.

If I would run the kill command by itself, it would successfully delete those files. However if there are no files named Trash*.txt, then the kill command would cause a failure in the program so I have no choice but to determine if any files named Trash*.txt exist first and that is what the "if" statement is supposed to do.

Since _FileExists won't work for this, can anyone suggest a workaround for me?


38
QB64 Discussion / Re: The QB64 Bible (Work In Progress)
« Last post by SMcNeill on April 14, 2022, 02:02:43 pm »
Small update just to prove to myself that I haven't forgotten about this project.  ;)

Finished up the Screen 32 topic.
Added _BIT type into the discussion.

Next up:  _FLOAT type.  People bring it up all the time, so it needs a nice little bit of documentation on it.  If anyone has any specific questions or ideas they'd like me to address or include when talking about _FLOAT, feel free to bring them up here.
39
QB64 Discussion / Re: Small graphics programming challenge
« Last post by bplus on April 14, 2022, 11:41:35 am »
Attachment fixed.  Sorry for posting the message twice.  Mornings......

Yeah mornings, flag file names are the same.
40
QB64 Discussion / Re: Small graphics programming challenge
« Last post by Richard Frost on April 14, 2022, 11:14:57 am »
Attachment fixed.  Sorry for posting the message twice.  Mornings......
Pages: 1 2 3 [4] 5 6 ... 10