UMG for reading code from a c++ file

Hello guys,
I’m trying to figure out a way to invoke a c++ script on clicking a umg button. To be preicse I want to create two buttons named read and write that are going to read data from a text file and write data to a text file when clicked.

You can use Macros on the functions in C++ code to allow access from blueprints:

UFUNCTION(BlueprintCallable, BlueprintPure)
	DataType ReadData();

UFUNCTION(BlueprintCallable)
	void WriteData(DataType Data);