Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

User 4396598

@User 4396598
About
Posts
20
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Is it possible to open file twice?
    U User 4396598

    yes, thankyou!

    C / C++ / MFC question

  • Is it possible to open file twice?
    U User 4396598

    Hi All, Is it possible to open the file twice? I am using CStdioFile, i created two objects of type CStdioFile and assigning the same file for both the objects. one file opened for writing(modeReadWrite) the data and the other file opened for reading(modeRead) the data. In this case my application is crashing. please give me some solution. CStdioFile obj1; CStdioFile obj2; obj1.Open("file1.txt", CStdioFile::modeReadWrite); ..... ..... ..... obj2.open("file1.txt", CStdioFile::modeRead); ..... ..... obj2.close(); .... ... obj1.close(); Thanks in advance! Regards, Anil

    C / C++ / MFC question

  • Problem in File seek()
    U User 4396598

    Hi All, I am reading some big files having thousands of lines, my requirement is to write some thing on the last but one line(i know the length of last line). how to seek my file pointer to last but one line with out seeking all the position from the beginning of the file? i tried with some code, but not achieving the right goal. please check the code

    		long seekval = assfile.SeekToEnd();
    		assfile.Seek((seekval - 4.0),0);
    		assfile.WriteString(\_T("some text"));
    

    assfile is the CStdioFile obj. 4 is the length of the last line. Thanks in advance. Regards, Kumar

    C / C++ / MFC help tutorial question

  • CString to double conversion.
    U User 4396598

    Hi all, I am trying to convert CString value to double value. see below

                   if(pos == 0)
    		{
    			assfile.ReadString(nextLine);
    			pos = nextLine.Find(\_T(","));
    			temp = nextLine.Left(pos);
    			dValue = \_wtof(temp);    // dValue is double variable
    			
    			if (dValue < minval)
    				minval = dValue;
    		}
    

    i am using _wtof() to convert string to double. The problem here is after conversion the double value has more decimal points every time. for example str = "234.555" after conversion the double value will be like this 234.55500005 i want the double value to be as it is in the string. how to resolve this? Thanks in advance. Regards, kumar

    hi

    C / C++ / MFC tutorial help question

  • How to convert a char array to CString?
    U User 4396598

    Thanks Cedric! The given article is very help full Can't we convert the char array like this? Cstring str(charr); //charr is char array Regards, Kumar

    C / C++ / MFC data-structures tutorial question

  • How to convert a char array to CString?
    U User 4396598

    Hi All, How to convert a char array into CString? I have one array like this char charr[1000]; .... drwFile.Read(charr,656); //reading some characters from the file CString str; how to store the charr array in to str? Regards, Kumar

    C / C++ / MFC data-structures tutorial question

  • How to use MFC in CLR Console Applications
    U User 4396598

    HI, Along with strings and arrays i want to use CDilogs also, please provide the solution for adding the MFC stuff to CLR Console Application. Regards, Kumar

    C / C++ / MFC c++ dotnet performance help tutorial

  • How to use MFC in CLR Console Applications
    U User 4396598

    Thanks for your reply Superman :) still is there any way to use MFC in CLR Console Application? Thanks in advance. Regards, Kumar

    C / C++ / MFC c++ dotnet performance help tutorial

  • How to use MFC in CLR Console Applications
    U User 4396598

    Hi All, I am beginner to MFC programming. I created one CLR Console Applications project, here in this project I want to use MFC classes like CString,CArray,CFile....etc. In project settings I used "Use MFC in a shared DLL" And in project stdafx.h file I am adding

    #include<afx.h>

    I also used few classes from MFC in the application and complied, I am not getting any errors. But while running the application, I am facing crash in the application. and the error message is as follows An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module. Additional information:Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Please provide some solution for this. Thanks in advance. Regards, Kumar

    C / C++ / MFC c++ dotnet performance help tutorial

  • CFileDialog doubt
    U User 4396598

    Thank you very much Pallini :) The problem is fixed! Is there any documentation available on this topic. Regards, Anil

    C / C++ / MFC tutorial

  • CFileDialog doubt
    U User 4396598

    Dear Pallini thanks for your reply! I tried with \0 still dialog not filtering. please check the code below.

    CFileDialog dlgFile(TRUE);
    CString fileName;
    const int c\_cMaxFiles = 100;
    const int c\_cbBuffSize = (c\_cMaxFiles \* (MAX\_PATH + 1)) + 1;
    dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(c\_cbBuffSize);
    dlgFile.GetOFN().nMaxFile = c\_cMaxFiles;
    dlgFile.m\_ofn.lpstrInitialDir = m\_sWorkpathPdm;
    dlgFile.m\_ofn.lpstrFilter = \_T("\*.sct\\0");
    dlgFile.DoModal();
    fileName.ReleaseBuffer();
    if (!fileName.IsEmpty())
    	m\_sMapFileName = fileName;
    UpdateData(FALSE);
    

    Regards, Anil

    hi

    C / C++ / MFC tutorial

  • CFileDialog doubt
    U User 4396598

    Thanks Pallini :) I have problem with filter, i am adding filter like this dlgFile.m_ofn.lpstrFilter = _T("*.pdm"); it has to display all .pdm files, but its not displaying .pdm files in the dialog. please help me in this regard. Thanks in advance. Regards, Anil

    C / C++ / MFC tutorial

  • CFileDialog doubt
    U User 4396598

    Hi All, I am using CFileDialog class in my application to browse a file. when i click on browse always by default application is opening desktop folder. I have one default path how to open that path instead of desktop. Thanks in advance. Regards, anil

    C / C++ / MFC tutorial

  • How to convert a CString object to char array in VC++ MFC
    U User 4396598

    Thanks Maya! :) what you said is correct... but i solved that problem in different way, I guess this is the easiest way. any how I am keeping that code here, it will be helpful for others. I used CStdioFile instead of CFile, that really simplifies my work.

    CStdioFile pdmFile;
    CStdioFile pdmSecFile;
    
    pdmFile.Open(m\_sPdmFileName, CStdioFile::modeRead);
    pdmSecFile.Open(\_T("testpdms\_changed.pdm"),CStdioFile::modeCreate | CStdioFile::modeReadWrite);
    
    CString sKey;
    CString sValue;
    POSITION pos;
    while(pdmFile.ReadString(strLine))
    {
    	pos =  mapingStrings.GetStartPosition();
    	while(pos != NULL)
    	{
    		mapingStrings.GetNextAssoc(pos, sKey, sValue);
    		strLine.Replace(sKey,sValue);
    	}
    	pdmSecFile.WriteString(strLine);
    	pdmSecFile.WriteString(\_T("\\n"));
    }
    pdmFile.Close();
    pdmSecFile.Close();
    

    Regards, Jo

    hi

    C / C++ / MFC c++ data-structures tutorial question

  • How to convert a CString object to char array in VC++ MFC
    U User 4396598

    Thanks joe for your comments. i changed code like this to eliminate char array.

    CFile pdmFile;
    CFile pdmSecFile;
    
    pdmFile.Open(\_T("c:\\\\strucadv15\\\\Work\\\\testpdms\\\\mod\\\\testpdms.pdm"),CFile::modeRead);
    pdmSecFile.Open(\_T("c:\\\\strucadv15\\\\Work\\\\testpdms\\\\mod\\\\testpdms\_changed.pdm"),CFile::modeCreate | CFile::modeReadWrite);
    
    
    CString strLinee;
    totlen = pdmFile.GetLength();
    for(int i = 0; i < totlen; i++)
    {
    	UINT lBytesRead = pdmFile.Read(ch,1);
    	if(ch\[0\] == '\\n')
    	{
    		pdmSecFile.Write(strLinee, strLinee.GetLength());
    		strLinee.Empty();
    	}
    	strLinee.AppendChar(ch\[0\]);
    }
    pdmFile.Close();
    pdmSecFile.Close();
    

    but still i got the same output like, after every character its appending one NULL please give me some solution. :) Regards, Jo

    hi

    C / C++ / MFC c++ data-structures tutorial question

  • How to convert a CString object to char array in VC++ MFC
    U User 4396598

    Thanks joe :) i have one more problem. please check the code below here pdmFile,pdmSecFile are two CFile objs.

    CString strLine;
    totlen = pdmFile.GetLength();
    for(int i = 0; i < totlen; i++)
    {
    	UINT lBytesRead = pdmFile.Read(ch,1);
    	if(ch\[0\] == '\\n')
    	{
    		int totl = strLine.GetLength();
    
    		TCHAR\* pStr = new TCHAR\[strLine.GetLength() + 1\];
    		lstrcpy(pStr, strLine);
    
    		pdmSecFile.Write(pStr, totl+1);
    		delete \[\] pStr;
    		pdmSecFile.Flush();
    		strLine.ReleaseBuffer(); 
    		strLine.Empty();
    	}
    	strLine.AppendChar(ch\[0\]);
    }
    pdmFile.Close();
    pdmSecFile.Close();
    

    iam trying to read each line from the first file and writing to second file. i am getting the out put but after every character its printing NULL character. please check the code and give me some solution to get the desired output. Thanks in advance! Regards, jo

    hi

    C / C++ / MFC c++ data-structures tutorial question

  • How to convert a CString object to char array in VC++ MFC
    U User 4396598

    Hi, Is there any MFC method to convert CString object to char array? please tell me how to do this. Thanks in advance. Regards, jo

    hi

    C / C++ / MFC c++ data-structures tutorial question

  • Split a string in MFC
    U User 4396598

    thanks dude :)

    hi

    C / C++ / MFC c++ tutorial question

  • Split a string in MFC
    U User 4396598

    Hi, How to split a String(CString obj) in MFC based on some tokens like spaces. is there any method for this? Thanks in advance. Regards, srinu

    hi

    C / C++ / MFC c++ tutorial question

  • File browser control in MFC
    U User 4396598

    Is there any file browser control in MFC? my requirement is, the application should allow the user to browse a file, based on the user selection i should get the selected file name and the corresponding file path to do some operations on that file. please provide the solution for this problem, thanks in advance Regards, Anil

    hi

    C / C++ / MFC c++ help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups