tags:

views:

219

answers:

2

Hello,

We have a requirement to parse a file and write the data to an excel file using C++. I did a search and able to find a project which serves my purpose. http://www.codeproject.com/KB/office/ExcelFormat.aspx

Please find a few lines of code below where exactly the errors occur.

typedef std::ctype CT;  
CT const& ct = std::_USE(std::locale(), CT);  
ct.widen(&str[0], &*str.begin()+str.size(), &ret[0]);

The above functions (eg. _USE) seem to be related to VC++. Can somebody please let me know what exactly the above piece of code does? and how to implement the same in native C++ functions?

Please let me know if any other information is needed...

Thanks!!

+1  A: 

It is difficult to answer without further information. In any case I would try

CT const & ct = std::use_facet<CT>( std::locale() );
Francesco
I tried using 'use_facet' but of no help. Thanks!!
krishna
what happened exactly? did you try the line I wrote? did you get the same error you were having before?
Francesco
I have already tried this earlier but the same error repeated. Probably I would have to check again and let you know how it goes. Thanks!!!
krishna
let me know. I added std:: before use_facet, to be consistent with std::locale.
Francesco
I think I have taken care of the namespace while using 'use_facet' anyways, I would give one more try and let you know. Thanks!
krishna
It worked like a magic!! Namespace seems to have done the trick. Thanks Francesco!!!! HAppy New Yr!!!
krishna
Happy new year to you!
Francesco
+1  A: 
Ned
Thanks Ned!! Excellent explanation!!
krishna
btw Happy New Year!!
krishna
Thank you. Happy 2010
Ned