I am using Fedora 31 64 bit. I am trying to translate some old quickbasic programs to freebasic (not qb compatible freebasic) while attempting to learn it.
Some of my old data files have dashes in the name. Linux and windows both support dashes in the name. When loading these files in freebasic I am having a problem. I have 'sort of' solved it by removing all the dashes, but this seems to be a 'bug'.
As an example the file 'element-new.data' will not load. No error is given, and the program goes on, but no data has been loaded. The file 'element.data' created just by changing the name (same data) loads the data gives no error and the data loads fine and the program goes on. It seems at the very least, if dashes are not acceptable this should throw an error. Since all the O.S.s support dashes, I would think that FB would support them.
I have tried this with several files (mostly comma separated variables) and I can post the programs and data files if needed.
John
File name issues (bug)??
-
- Posts: 42
- Joined: Jun 21, 2016 13:06
Re: File name issues (bug)??
Hi,
as long as you've got library issues (libtinfo* e.t.c) you'll not know anything for certain.
Reason: you are currently having "undefined behaviour", which can be anything.
As a result, you may encouter any number of 'bugs' which are not really there.
Therefore, sort out your FBC installation first (before opening more threads).
I don't think that FBC has any (real) issues with undeline/dash characters.
(I'm using both in the very same file-name, without problems.)
as long as you've got library issues (libtinfo* e.t.c) you'll not know anything for certain.
Reason: you are currently having "undefined behaviour", which can be anything.
As a result, you may encouter any number of 'bugs' which are not really there.
Therefore, sort out your FBC installation first (before opening more threads).
I don't think that FBC has any (real) issues with undeline/dash characters.
(I'm using both in the very same file-name, without problems.)
Re: File name issues (bug)??
This works fine here on Ubuntu Mate 18.04 64-bit, fbc 1.07.1 32-bit & fbc 1.07.1 64-bit:
Code: Select all
dim as string fileName = "-test-file-.1-2"
dim as integer fileNum = freefile
if open(fileName, for output, as fileNum) <> 0 then
print "Error opening file for write: " & fileName
else
print #fileNum, "This is a test"
close #fileNum
print "Data written to: " & fileName
end if
if open(fileName, for append, as fileNum) <> 0 then
print "Error opening file for append: " & fileName
else
print #fileNum, "Add another line of text"
close #fileNum
print "Data written to: " & fileName
end if
dim as string dataStr = ""
if open(fileName, for input, as fileNum) <> 0 then
print "Error opening file for input: " & fileName
else
Print "Read data from: " & fileName
while not eof(fileNum)
line input #fileNum, dataStr
print " " & dataStr
wend
close #fileNum
end if
print "End"
while inkey = "" : sleep 1 : wend
Re: File name issues (bug)??
The code above compiles and executes as expected on my Fedora 31 X64 machine.badidea wrote:This works fine here on Ubuntu Mate 18.04 64-bit, fbc 1.07.1 32-bit & fbc 1.07.1 64-bit:Code: Select all
dim as string fileName = "-test-file-.1-2" dim as integer fileNum = freefile if open(fileName, for output, as fileNum) <> 0 then print "Error opening file for write: " & fileName else print #fileNum, "This is a test" close #fileNum print "Data written to: " & fileName end if if open(fileName, for append, as fileNum) <> 0 then print "Error opening file for append: " & fileName else print #fileNum, "Add another line of text" close #fileNum print "Data written to: " & fileName end if dim as string dataStr = "" if open(fileName, for input, as fileNum) <> 0 then print "Error opening file for input: " & fileName else Print "Read data from: " & fileName while not eof(fileNum) line input #fileNum, dataStr print " " & dataStr wend close #fileNum end if print "End" while inkey = "" : sleep 1 : wend
Re: File name issues (bug)??
As always, compile with -exx so that runtime error checking is enabled. Often that will catch weird things that don't crash the program (but probably should).Helium5793 wrote:As an example the file 'element-new.data' will not load. No error is given, and the program goes on, but no data has been loaded.
-
- Posts: 42
- Joined: Jun 21, 2016 13:06
Re: File name issues (bug)??
Thank you for all your replies. I have spent days now on the libtinfo error, and since the library is there, it is difficult to figure out why freebasic doesn't read it. I appreciate knowing the dashes work under ubuntu. That may be a clue I can use.
John
John
-
- Posts: 42
- Joined: Jun 21, 2016 13:06
Re: File name issues (bug)??
Thank you for your replies. I thought that was a pretty strange error I was seeing. I was able to download the zip file from github, recompile under Fedora using the provided make file, copy the recompiled fbc program over the one installed using the method on github for fedora. Once I did the the libtinfo.so.5 error and the linking error disappeared. After doing that this file loading error disappeared also, and I can now load files with dashes.
Thank you all for your help,
John
Thank you all for your help,
John
Re: File name issues (bug)??
I believe that the pre-compiled FB distribution is using an older version of libtinfo.so.5 hence the problem.