Home | News | Documentation | Download

How to write output in external hard disc

Hi,

I am trying to write the output of a code in external hard disc for this I put the address of my disc in following way

HepMC::IO_GenEvent ascii_io("/media/saswati/Seagate\ Backup\ Plus\ Drive/hepmcout41mygg.dat", std::ios::out);

but while compiling I am getting error like

main41.cc:25:31: warning: unknown escape sequence: ‘\040’ [enabled by default]
HepMC::IO_GenEvent ascii_io("/media/saswati/Seagate\ Backup\ Plus\ Drive/hepmcout41mygg.dat", std::ios::out);
^
main41.cc:25:31: warning: unknown escape sequence: ‘\040’ [enabled by default]
main41.cc:25:31: warning: unknown escape sequence: ‘\040’ [enabled by default]

Can anybody please let me know the wright way to put the address of external hard disc in the code?

Thanks,
Saswati

I believe the problem is the escaped space character you have in the file name. If you are on Linux, just remove the backslashes, or save the file to your home directory, then move to the final directory. Cheers,

Hi,

The problem is that in my home area i don’t have space that’s why I want to write directly to external disc. If I remove the space simply it wouldn’t find out the exact location of the disc, how can I remove the space and at the same time provide the correct location of the disc?

Thanks,

Saswati

HepMC::IO_GenEvent ascii_io("/media/saswati/Seagate Backup Plus Drive/hepmcout41mygg.dat", std::ios::out);

the backslashes are only needed in your shell.

Hi sbinet,

But how shall I remove the blank space? If I simply use

HepMC::IO_GenEvent ascii_io("/media/saswati/Seagate Backup Plus Drive/hepmcout41mygg.dat", std::ios::out);

It's not getting the right address even if I remove thv blank space, it doesn't work.

Thanks,

Saswati

what do you mean by “It’s not getting the right address” ?

alternatively, you could create a symlink:

$> cd $HOME
$> ln -s /media/saswati/Seagate\ Backup\ Plus\ Drive ./seagate

and then:

HepMC::IO_GenEvent ascii_io("/home/saswati/seagate/hepmcout41mygg.dat", std::ios::out);

Hi sbinet,

Thanks a lot! It’s working now.

Thanks,

Saswati