how to replace \n with alt+enter while exporting to .CSV
I am writing line by line to a file(.CSV). If the string is having "\n" in between then the multiline is not possible for a single cell and it is coming to the next line of Excel .
Can anyone help me to replace the "\n" with "Alt+Enter" equivalent?
I am using CSting to collect the entire line at a tiime.
I am trying as below
Let the line feed in place and enclose the cell content by double quotes. This should be accepted by Excel when rows are terminated by carriage return - line feed pairs. So your CSV file should look like:
Row1:Col1, "Row1:Col2\n with new line"\r\n
Row2:Col1, "Row2:Col2, with comma"\r\n
Row3:Col1, "Row3:Col2 with "" esacped quote"\r\n
Row4:Col1, " Row4:Col2 begins and/or ends with space "\r\n
As an alternative you may write HTML files using tables. These can be also imported by Excel.
The output window show the following error messages:
First-chance exception at 0xfefefefe in SchPedestal.exe: 0xC0000005: Access violation.
Unhandled exception at 0xfefefefe in SchPedestal.exe: 0xC0000005: Access violation.
The program ' SchPedestal.exe: Native' has exited with code -1073741819 (0xc0000005).
ClassInfo inherits from CPropertySheet, while the other objects inherit from CPropertyPage.
If you expect the error to be in the posted code, set a breakpoint on top and use the debugger to step through the instructions until the error occurs. Then check your variables to find out which is generating the access violation.
ClassInfo inherits from CPropertyPage, while the other objects inherit from CPropertyPage.
The program successfully displays the wizards start page, but once I click next, this access violation occurs
Debugging shows that the access violation occurred in the following function:
CComboBox *pSchoolName = (CComboBox *)GetDlgItem(IDC_COMBO1);
//Get database path
StringCbCopyA(szString,sizeof(szString),"SELECT SchInfoID,SchName,SchCity,SchState,SchCountry FROM SchInfo");
CppA::CppSQLite3Query q = db.execQuery(szString);
//Gets first row
for (int fld = 0; fld < q.numFields(); fld++)
iSchoolInfoID = q.getInt64Field(0);
p = q.getStringField(1);
p = q.getStringField(2);
p = q.getStringField(3);
p = q.getStringField(4);
int i = pSchoolName->AddString(szSchoolName);//This is where the access violation occurred.
catch(CppA::CppSQLite3Exception & e)
StringCbPrintfA(szString,sizeof(szString),"Error Code: %d\n Error Mesage: %s",e.errorCode(),e.errorMessage());
MessageBoxA(NULL,szString,"Load shc name Error",MB_OK);
Actually, at the start the property page objects were members of the PropertySheet object.
Also, initially, the LoadSchoolName function was part of a win32 dll( I made it so for maintenace purpose) which the MFC extension dll ClassInfo.dll load or links with.
But when access violation kept occuring at that location of the function, I decided to make the function a member function in the MFC extension DLL, rather that a win32 dll.
Well, that did not solve the problem. So, I read through msdn and saw that example on DoModal() did not make the property pages member of the propertysheet object, so I decided to try that next, but still the same problem.
Shown below is the function that calls the LoadSchoolName function:
ClassInfo * pPropertySheet = (ClassInfo *)m_Pointer;
CComboBox *pCombo2 = (CComboBox *)GetDlgItem(IDC_COMBO2);
int i = 0;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
The OnInitDialog function loads various school names from data base and uses them to fill the stated combobox. Like I said the wizard displays the wizard's start page , but each time I click next, the the access violation occurs.
If I comment out the LoadSchoolName function, the wizard successfully load the next Property page , but with an empty combobox.
So I decided to replace the combobox pointer in the LoadSchoolName function with a
Object( I cast each SchoolName TCHAR pointer to ULONG_PTR using a reinterpret_cast. So that I call add the strings to the combobox from the CArray object.
On doing this , access violation occures at the point in the code where I call CArray
It appears thar whetther I try to add the string to a combobox or an array, each time I attempt to addd the school name string, access violation occurs. I don't just understand why.
You are formatting quite a lot of things into the school name. Maybe you create more than 100 characters and the StringCbPrintf() doesn't add the terminating \0 character in that case. You could try
szSchoolName = 0;
before calling AddString() and see if that changes anything.
The good thing about pessimism is, that you are always either right or pleasently surprised.
The flash memory of the PIC controllers is the program memory where code is stored. You can initialize the variable at compile time and it will be written together with the program code.
To write to the program memory by the running program you need to execute special instructions. For the PIC 32 see section 5. Flash Programming[^ PDF] of the PIC32 Family Reference Manual.
A compiler or assembler may provide functions or macros to perform the writing or compilers may have built-in support for writing. So the answer if the value is written depends on the used compiler. But if the compiler does not support writing to flash memory, you will get an error at compile time.
it really depends on the company/implementation - I doubt there's any 'standard' meaning, eg 'Example', 'Extension' - the only way to know for sure is a side-by-side comparison using [insert name of your favourite diff/compare tool here]
thank you very much. i had to name something where it was in appropriate to overload, and I couldn't think of an appropriate name. i saw something in microsoft's thread or mutex library that used that naming convention. I should have realized Ex meant "extended", duh. Kind regards,
I have an ATL dialog based applications.
I have a custom list control derived from CListCtrl with message map
BEGIN_MESSAGE_MAP( MyListCtrl, CListCtrl )
ON_NOTIFY_REFLECT( NM_CUSTOMDRAW, &MyListCtrl::OnNMCustomDraw )
void MyListCtrl, ::OnNMCustomDraw( NMHDR *pNMHDR, LRESULT *pResult )
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>( pNMHDR);
// Take the default processing
*pResult = CDRF_DODEFAULT;
if( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
*pResult = CDRF_NOTIFYITEMDRAW;
else if( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
int nRow = static_cast<int>(pLVCD->nmcd.dwItemSpec );
if( true == MyArray[nRow].bIsOlder )
pLVCD->clrText = RGB( 128, 128, 128 );
pResult = CDRF_DODEFAULT;
But I am not getting ant reflected message from the parent dialog.
I know that it can be done by using the REFLECT_NOTIFICATIONS() in the parent class. But I read that we have to derive the CListCtrl from CContained window. Is it the right way, if so what are things I have to take care.
Is there any better solution to resolve this issue?