Home | Tutorials | Wiki | Issues
Ask Your Question
0

Opening a text file through a plugin

asked 2016-02-17 04:05:17 -0600

pap-x gravatar image

updated 2016-02-17 04:08:42 -0600

I'm trying to open a text file through a plugin to get timestamps and positions for keyframes of a model animation. I'm opening the file using ifstream(). Unfortunately no matter where I place the text file it won't be opened by the plugin. What can I do?

edit retag flag offensive close merge delete

Comments

Have you tried using the file's full path? Does that work?

chapulina gravatar imagechapulina ( 2016-02-17 09:12:33 -0600 )edit

Yeap! Full path did work, thank you! (Had tried that already but I was missing something probably)

pap-x gravatar imagepap-x ( 2016-02-18 01:14:56 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-02-17 09:25:35 -0600

debz gravatar image

Hi,

I also use an external file for my current project. Here is the code:

std::ifstream f(path.c_str(), std::ios::in);

Here, path is a std::string object. Be ware that the path is relative to the folder where you run gazebo, NOT relative to the folder of your plugin. If you know exactly where you run gazebo, then adapt your path or you can use an absolute path, as chapulina said.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-17 04:05:17 -0600

Seen: 108 times

Last updated: Feb 17 '16