I think it’s just a nature of me: I always get excited by just learning something new, figuring out a problem, fixing a bug in the program, drawing a cool graph, writing up a research report, etc.

Yet, I just can’t help to share this excitement with others. Since I posted too much on my WeChat moments, my friends are tired with what I posted, because most of time they don’t understand. Well, that still doesn’t stop me from sharing what I have just got, the excitement.

At least, since I have this little website now, I guess I can just put all of my excitement here.

By the way, the excitement which I want to share this time is that after about an hour of debugging, I finally wrote a piece of code that can do exactly what I really want it to do:

A ROOT macro that can read the environmental variable and use the content of the variable

The purpose is that I can simply change the environmental variable for the path of the data files, and then only needs to modify a little bit in the code. (Probably this is not the most efficient way, but it’s what I can come up with at this point.)

Screen Shot 2017-08-19 at 11.14.35 PM.png

Several mistakes I made is that the std::getenv(const char*) function only reads the environment variable, which means that I have to export whatever the variable that I want to read. In the above case, I have to export Maxwell in terminal.

Another tricky part is that char* is not a string literal. To make it a string literal, it should be const char* . Otherwise, I will have problem with reading the variable by using the getenv function. Also, the convention from char* to std::string is not allowed by c++11, but a const char* is okay.

Anyway, that’s what I got just now. I am going to keep working on the program now. The entire program should be on my GitHub in the next two days, hopefully.

2 thoughts on “Excitements

  1. 有些梦想和爱好是别人不能理解的,我经常发的演唱会小视频能得到的共鸣也很少,但是这不妨碍我高兴和喜欢~

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s