Click here to Skip to main content
15,892,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
General\n and \r\n Question Pin
Cerb2-Sep-02 3:11
sussCerb2-Sep-02 3:11 
GeneralRe: \n and \r\n Question Pin
Jawache2-Sep-02 3:23
Jawache2-Sep-02 3:23 
GeneralRe: \n and \r\n Question Pin
Joaquín M López Muñoz2-Sep-02 3:25
Joaquín M López Muñoz2-Sep-02 3:25 
GeneralRe: \n and \r\n Question Pin
Cerb2-Sep-02 3:31
sussCerb2-Sep-02 3:31 
GeneralRe: \n and \r\n Question Pin
Jawache2-Sep-02 3:39
Jawache2-Sep-02 3:39 
GeneralRe: \n and \r\n Question Pin
Cerb2-Sep-02 3:49
sussCerb2-Sep-02 3:49 
GeneralRe: \n and \r\n Question Pin
Jawache2-Sep-02 3:49
Jawache2-Sep-02 3:49 
GeneralRe: \n and \r\n Question Pin
Cerb2-Sep-02 5:25
sussCerb2-Sep-02 5:25 
To save and open I use:

int saved = 0;
CString fileinfo;

void CFastPHPDlg::OnFileSave()
{

char szFilter[]="Fichier HTML(*.html)|*.html|Fichier SHTML(*.shtml)|*.shtml|Fichier PHP(*.php)|*.php|Fichier PHP3(*.php3)|*.php3|Fichier PHP4(*.php4)|*.php4|Fichier PHTML(*.phtml)|*.phtml|";
CFileDialog dlgFile(FALSE, "html", "*.html", OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, szFilter, this);

CString output;



if(saved == 0)
{
if(dlgFile.DoModal() == IDOK)
{
htmlfile = fopen(dlgFile.GetFileName(), "w+");
m_phpEdit.GetWindowText(output);
fputs(output, htmlfile);
fclose(htmlfile);
CFastPHPDlg::SetWindowText(dlgFile.GetFileName());
CFastPHPDlg::GetWindowText(fileinfo);
CFastPHPDlg::SetWindowText("FastPHP - " + dlgFile.GetFileName());
saved++;
}
}

else
{
htmlfile = fopen(fileinfo, "w+");
//CString output;
m_phpEdit.GetWindowText(output);
fputs(output, htmlfile);
fclose(htmlfile);
CFastPHPDlg::SetWindowText("FastPHP - " + fileinfo);
saved++;
}


}

void CFastPHPDlg::OnFileOpen()
{
char szFilter[]="Fichier HTML(*.html)|*.html|Fichier SHTML(*.shtml)|*.shtml|Fichier PHP(*.php)|*.php|Fichier PHP3(*.php3)|*.php3|Fichier PHP4(*.php4)|*.php4|Fichier PHTML(*.phtml)|*.phtml|";
CFileDialog dlgFile(FALSE, "html", "*.html", OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, szFilter, this);
if(dlgFile.DoModal() == IDOK)
{
CString input;
char temp[200];
htmlfile = fopen(dlgFile.GetFileName(), "r+");
while(!feof(htmlfile))
{
fgets(temp, 200, htmlfile);
input=input+temp;
}
m_phpEdit.SetWindowText(input);
fclose(htmlfile);
CFastPHPDlg::SetWindowText(dlgFile.GetFileName());
CFastPHPDlg::GetWindowText(fileinfo);
CFastPHPDlg::SetWindowText("FastPHP - " + dlgFile.GetFileName());
saved++;
}
}


*Fichier = File, in french. Because my program is in french.

Thanks for helping me
GeneralRe: \n and \r\n Question Pin
Jawache2-Sep-02 5:34
Jawache2-Sep-02 5:34 
GeneralRe: \n and \r\n Question Pin
Simon.W2-Sep-02 4:17
Simon.W2-Sep-02 4:17 
GeneralOnVScroll Listcontrol Scroll Mouse Pin
Koep2-Sep-02 3:02
Koep2-Sep-02 3:02 
GeneralAn ADO problem Pin
Anonymous2-Sep-02 2:13
Anonymous2-Sep-02 2:13 
GeneralRe: An ADO problem Pin
Prem Kumar2-Sep-02 2:23
Prem Kumar2-Sep-02 2:23 
GeneralNeed Help With CHtmlView !! Pin
onkarp2-Sep-02 1:41
onkarp2-Sep-02 1:41 
GeneralRe: Need Help With CHtmlView !! Pin
Stephane Rodriguez.2-Sep-02 2:14
Stephane Rodriguez.2-Sep-02 2:14 
GeneralRe: Need Help With CHtmlView !! Pin
onkarp3-Sep-02 1:11
onkarp3-Sep-02 1:11 
GeneralCComboBox Edit Mode Pin
Jawache2-Sep-02 1:11
Jawache2-Sep-02 1:11 
GeneralRe: CComboBox Edit Mode Pin
Jon Hulatt2-Sep-02 1:22
Jon Hulatt2-Sep-02 1:22 
GeneralRe: CComboBox Edit Mode Pin
Jawache2-Sep-02 1:39
Jawache2-Sep-02 1:39 
QuestionHow to add tooltip to picture control Pin
Prateeti2-Sep-02 1:10
Prateeti2-Sep-02 1:10 
AnswerRe: How to add tooltip to picture control Pin
Joaquín M López Muñoz2-Sep-02 2:28
Joaquín M López Muñoz2-Sep-02 2:28 
AnswerRe: How to add tooltip to picture control Pin
Roger Allen2-Sep-02 2:29
Roger Allen2-Sep-02 2:29 
QuestionHow to prevent a child window from move from its original position. Pin
daybreak2-Sep-02 0:30
daybreak2-Sep-02 0:30 
AnswerRe: How to prevent a child window from move from its original position. Pin
.dan.g.2-Sep-02 14:41
professional.dan.g.2-Sep-02 14:41 
GeneralRe: How to prevent a child window from move from its original position. Pin
daybreak2-Sep-02 23:44
daybreak2-Sep-02 23:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.