Click here to Skip to main content
15,906,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Working with INI Related functions Pin
swaapu2-Feb-06 20:36
swaapu2-Feb-06 20:36 
GeneralRe: Working with INI Related functions Pin
_anil_2-Feb-06 21:06
_anil_2-Feb-06 21:06 
GeneralRe: Working with INI Related functions Pin
swaapu2-Feb-06 21:56
swaapu2-Feb-06 21:56 
GeneralRe: Working with INI Related functions Pin
_anil_2-Feb-06 22:06
_anil_2-Feb-06 22:06 
GeneralRe: Working with INI Related functions Pin
swaapu2-Feb-06 22:25
swaapu2-Feb-06 22:25 
GeneralRe: Working with INI Related functions Pin
_anil_2-Feb-06 22:32
_anil_2-Feb-06 22:32 
GeneralRe: Working with INI Related functions Pin
swaapu2-Feb-06 22:39
swaapu2-Feb-06 22:39 
GeneralRe: Working with INI Related functions Pin
_anil_2-Feb-06 23:34
_anil_2-Feb-06 23:34 
Try this one...


{
FILE *fpr,*fpw;
CHAR buffer[50];
DWORD nSize=50;
LPTSTR lpszReturnBuffer;
CHAR buff[50];

fpr = fopen("C:\\SWATI.INI","r");
fpw = fopen("C:\\Ss.txt","w");

lpszReturnBuffer = buff;
fprintf(fpw,"");

memset(buffer, 0x00, 50);
GetPrivateProfileSectionNames(buffer,nSize,"C:\\SWATI.INI");
char* pBuffer = buffer;
int nWrite = 0;

while(strlen(pBuffer) > 0){ // For all Section Name

nWrite = fprintf(fpw,"\n<%s>",pBuffer); // Print the SectionName < SECTION >
memset(buff, 0x00, 50);

GetPrivateProfileSection(pBuffer,buff,nSize,"C:\\SWATI.INI");
char* pBuff = buff;
int nWrt = 0;

while(strlen(pBuff) > 0){ // For all KEY=VALUE

CString strToken;
strToken = pBuff; // The the KEY with Value "KEY=VALUE"

// Find the = character inside the string
INT nPosEql = strToken.Find('=');
if(nPosEql == -1){
break;
}

CString strKey = strToken.Left(nPosEql); // Get the Key
CString strVal = strToken.Mid(nPosEql + 1); // Get the value

fprintf(fpw, "\t\n<%s>", strKey); // Print <KEY>
fprintf(fpw, "%s", strVal); // Print VALUE
fprintf(fpw, "</%s>", strKey); // Print </KEY>

pBuff = pBuff + strlen(pBuff) + 1; // Move to next key
}

fprintf(fpw,"\n</%s>",pBuffer); // Print the </SECTION>
pBuffer = pBuffer + strlen(pBuffer) + 1; //Move to next section
}

fclose(fpr);
fclose(fpw);
}
GeneralRe: Working with INI Related functions Pin
swaapu5-Feb-06 20:12
swaapu5-Feb-06 20:12 
GeneralRe: Working with INI Related functions Pin
alleyes24-Jul-09 4:45
professionalalleyes24-Jul-09 4:45 
AnswerRe: Working with INI Related functions Pin
Jagadeesh VN2-Feb-06 20:34
Jagadeesh VN2-Feb-06 20:34 
GeneralRe: Working with INI Related functions Pin
swaapu2-Feb-06 20:43
swaapu2-Feb-06 20:43 
GeneralRe: Working with INI Related functions Pin
Jagadeesh VN2-Feb-06 20:51
Jagadeesh VN2-Feb-06 20:51 
AnswerRe: Working with INI Related functions Pin
John R. Shaw2-Feb-06 21:59
John R. Shaw2-Feb-06 21:59 
QuestionRun-Time Check Failure #3 Pin
newbie53452-Feb-06 20:15
newbie53452-Feb-06 20:15 
AnswerRe: Run-Time Check Failure #3 Pin
John R. Shaw2-Feb-06 23:19
John R. Shaw2-Feb-06 23:19 
GeneralRe: Run-Time Check Failure #3 Pin
newbie53453-Feb-06 11:12
newbie53453-Feb-06 11:12 
QuestionDrag and Drop Pin
Anil_vvs2-Feb-06 19:58
Anil_vvs2-Feb-06 19:58 
AnswerRe: Drag and Drop Pin
Prakash Nadar2-Feb-06 20:02
Prakash Nadar2-Feb-06 20:02 
GeneralRe: Drag and Drop Pin
Anil_vvs2-Feb-06 20:03
Anil_vvs2-Feb-06 20:03 
GeneralRe: Drag and Drop Pin
Anil_vvs2-Feb-06 20:14
Anil_vvs2-Feb-06 20:14 
AnswerRe: Drag and Drop Pin
Jagadeesh VN2-Feb-06 20:14
Jagadeesh VN2-Feb-06 20:14 
GeneralRe: Drag and Drop Pin
Anil_vvs2-Feb-06 20:17
Anil_vvs2-Feb-06 20:17 
QuestionWhat is the proper way to implement this? Pin
LeeeNN2-Feb-06 19:53
LeeeNN2-Feb-06 19:53 
AnswerRe: What is the proper way to implement this? Pin
Jagadeesh VN2-Feb-06 20:08
Jagadeesh VN2-Feb-06 20:08 

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.