Jump to content

Freepascal string to filename

Zahuczky

Hey guys. I have a question.
Is it possible in Freepascal, assign a variable as a filename? For example 
 
 

Var a:string;
       f:text;

Begin 
assign(f,a);
reset(f);


I just had my high-school exam from advanced IT, and usually when the filename has to be a variable, they state that in the task, that if it's not possible use any name. This wasn't there this year.
And to my knowledge, there's no way to use a variable as filename. 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, James Evens said:

File handling is done with objects. Doesn't matter if it is a stream or more advance parser like Image.loadfromfile(varPath). Those function require a String with the path when called/setup.

 

Could you please give me an example, or like an article for this? Even if it's possible, it might be harder than what is needed on the exam.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×