Forum Navigation
You need to log in to create posts and topics.

Babysteps03

Posted by: bill <bill@...>

Members of the group have been very helpful getting me restarted in programming and I hope it has not been as much of an uphill climb for them as it has been for me. Much has changed from FB 5 to FB 7. Some items that worked very well in FB 5 don’t do so in FB 7. In order not to be peppering the group with a zillion questions, I’ve been spending a lot of time “cutting and trying” until I get something that works.

Here are some of the things I noticed:

1.
short I%
short array%(10)
for I% = 1 to 10
array%(I%)=I%
next I%

This won’t compile. If I change I% to II%, it does. And if I change I% to J%, it does compile. 

Cutting and trying even further, just this one statement causes the compilation to fail:

short I%

Is the variable I% now off limits?

2.
An input text file created with Text Editor with 3 records

Record1
Record2
123

needs a carriage return (or perhaps line feed) after record 3, or a fourth blank record to allow record 3 to be input correctly. (This may always have been the case, and I just didn’t realize it, because I frequently had blank lines at the end of my input files of control parameters) 

3. 
Most of my programs have at the minimum 2 files:

Audittrail - strictly output, containing progress indicators and possible debugging information. Each running of the program should start with a blank file.

Controlfile - read only, containing parameters that indicate what the program is to do, and path names of data files the program is to process. This is created beforehand, in a text editor, and the program assumes it exists.

These both have names that tie them to their program
programname_Audittrail.txt
programname_Controlfile.txt

I implemented Ken’s suggestion for Audittrail in the following way:

CFURLRef appDirURL
CFURLRef AuditTrailURL

appDirURL = fn FileManagerURLForApplicationDirectory

AuditTrailURL  = fn URLByAppendingPathComponent( appDirURL, @"_AuditTrail.txt"  )

// Check if _AuditTrail.txt file exists
if ( fn FileManagerFileExistsAtURL( AuditTrailURL ) == YES )
// If it exists trash it (safe)...
FileManagerTrashItemAtURL( AuditTrailURL )
end if

// open it anew
open "O", 5, @AuditTrailURL

When I use the Run command in the FB editor to compile and run my test program (Test01) the first time after making changes in the program, OS 11.4 Big Sur asks me if I want to allow Test01 to access files in my Documents folder. I say allow and the existing AuditTrail file is deleted, but no new one is created. If I use the Run command again immediately, I’m not asked for permission and the Audittrail file is created.

What don’t I understand?







--
To unsubscribe, send ANY message to: [email protected] To access the list archives, go to: http://freegroups.net/groups/futurebasic/