Restored from previous forum. Originally posted by CoderLaureate.
Are they possible in Pure Basic?
I try and my machine crashes.
---------------------------------------------
AMD Duron 950Mhz/Windows XP Pro
Recursive Function Calls
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Yes, they are possible.
How often do you call your procedure?
Maybe there is another problem in your source causing the crash?
What about posting some source here?
Timo
--------------------------------------------------
http://purebasic.dyn.ee/
Yes, they are possible.
How often do you call your procedure?
Maybe there is another problem in your source causing the crash?
What about posting some source here?
Timo
--------------------------------------------------
http://purebasic.dyn.ee/
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by CoderLaureate.
Sorry about that Timo, I completely forgot to post some code.
---------------------------------------------
AMD Duron 950Mhz/Windows XP Pro
Sorry about that Timo, I completely forgot to post some code.
Code: Select all
Procedure FileBot(Path$)
Dir = DirNo()
If ExamineDirectory(Dir,Path$,"")
FileBotCount = FileBotCount + 1
ne = NextDirectoryEntry()
While ne 0
Select ne
Case 1
FileList$ = FileList$ + Path$ + DirectoryEntryName() + FileSepChar$
Case 2
FileBot(Path$ + "\" + DirectoryEntryName())
EndSelect
ne = NextDirectoryEntry()
Wend
FileBotCount = FileBotCount - 1
EndIf
EndProcedure
AMD Duron 950Mhz/Windows XP Pro
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
just some questions:
DirNo() ? procedure, linked list or what?
Dir, FileBotCount, FileList$ ? Global or local variables?
A word of caution: PureBasic strings are at the moment restricted to 64kBytes so if FileList$ is global and you store a lot of files there your program is going to crash.
you might get some help from this link too:
viewtopic.php?t=5143
just some questions:
DirNo() ? procedure, linked list or what?
Dir, FileBotCount, FileList$ ? Global or local variables?
A word of caution: PureBasic strings are at the moment restricted to 64kBytes so if FileList$ is global and you store a lot of files there your program is going to crash.
you might get some help from this link too:
viewtopic.php?t=5143
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by CoderLaureate.
DirNo() is a procedure that increments a pointer and returns the value. Dir is the local variable that holds the value. FileList$ is global, as well as FileBotCount.
I thought of the string length thing, and as an experiment replaced it with: Debug Path$ + DirectoryEntryName()
Just to see if it would print.
---------------------------------------------
AMD Duron 950Mhz/Windows XP Pro
DirNo() is a procedure that increments a pointer and returns the value. Dir is the local variable that holds the value. FileList$ is global, as well as FileBotCount.
I thought of the string length thing, and as an experiment replaced it with: Debug Path$ + DirectoryEntryName()
Just to see if it would print.
---------------------------------------------
AMD Duron 950Mhz/Windows XP Pro
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
You say, DirNo() inrements a Pointer? So maybe there is some pointer-related Bug in there, as pointers easily produce program crashes.
The Procedure seems ok. I see no reason for it to crash in there, so It is maybe in the other Procedure.
Another thing:
> FileBot(Path$ + "\" + DirectoryEntryName())
After that, there should be a 'UseDirectory(Dir)' line, because if the Procedure is called
another Directory will be examined, and after a return, you must set the examined Directory back to the one it was, so the while/wend reads from the right Directory again.
Timo
You say, DirNo() inrements a Pointer? So maybe there is some pointer-related Bug in there, as pointers easily produce program crashes.
The Procedure seems ok. I see no reason for it to crash in there, so It is maybe in the other Procedure.
Another thing:
> FileBot(Path$ + "\" + DirectoryEntryName())
After that, there should be a 'UseDirectory(Dir)' line, because if the Procedure is called
another Directory will be examined, and after a return, you must set the examined Directory back to the one it was, so the while/wend reads from the right Directory again.
Timo
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by CoderLaureate.
Thank you very much for your help.
That (along with some pointers on the link pupil gave me) did the trick. I'm loading the file list into a linked list. (This is for a console application, so I'm not building a tree).
Thanks again, your help was well received.
-Jim
---------------------------------------------
AMD Duron 950Mhz/Windows XP Pro
Thank you very much for your help.
That (along with some pointers on the link pupil gave me) did the trick. I'm loading the file list into a linked list. (This is for a console application, so I'm not building a tree).
Thanks again, your help was well received.
-Jim
---------------------------------------------
AMD Duron 950Mhz/Windows XP Pro