# UMG and C++

**URL:** <https://forums.unrealengine.com/t/umg-and-c/100969>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [October 9, 2017, 2:56am UTC](https://forums.unrealengine.com/t/umg-and-c/100969 "2017-10-09T02:56:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vydurr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vydurr](https://forums.unrealengine.com/u/vydurr)\
**Post date:** [October 9, 2017, 2:56am UTC](https://forums.unrealengine.com/t/umg-and-c/100969/1 "2017-10-09T02:56:43Z")

</div>

Hello guys,

I am trying to figure out a way to attach a c++ script to a button in umg. What I am basically trying to achieve is a read and write button in UMG which when clicked run c++ scripts for reading text from a text file or write text to a text file…any help is appreciated. I’m really stuck. Thank you.

---

<div class="post-metadata">

**Author:** ![ArcEcho](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ArcEcho](https://forums.unrealengine.com/u/ArcEcho)\
**Post date:** [October 9, 2017, 6:06am UTC](https://forums.unrealengine.com/t/umg-and-c/100969/2 "2017-10-09T06:06:39Z")

</div>

There are two simple ways to solve your problem.

1. Use C++ blueprint function library
2. Create a C++ UserWidget and write your code, then create child UMG from it.
