Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Reading "csv" data from Clipboard question

Hi,
I'm trying to read data from excel to my application and I have some difficulties when the System decimal symbol is changed. My code look something like this:

/**************************************
UINT aFmt = ::RegisterClipboardFormat(_T("Csv"));
COleDataObject aClipboardData;
aClipboardData.AttachClipboard();
if (aClipboardData.IsDataAvailable(aFmt))
{
    CFile *pTableData = aClipboardData.GetFileData(aFmt);
    ...
}
/***************************************

when i'm copying from excel a 2x2 table with the values of:
1 2
3 4

then the content of my file will be:
1. if the decimal symbol is ".":
   1,2
   3,4
2. If the decimal symbol is ",":
   1;2
   3;4

I need to parse the file and I must know what is the value of the separator char ("," in case 1 and ";" in case 2)

Is there an API function that retrieve this separator value ???

BTW, currently I solve this in an ugly way by getting the decimal symbol (with GetLocaleInfo() method):

/*******************************
CString aDecSym = GetLocalInfo(...,LOCALE_SDECIMAL)
mSeperator = ( aDecSym == ',' ) ? ';' : ',';
/*******************************

Thanks,
Yoav
0
yoavo
Asked:
yoavo
1 Solution
 
migelCommented:
Hi!
did you try
CString aDecSym = GetLocalInfo(...,LOCALE_SLIST);//??
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now