How to convert from string to char.
Please help me....
/**********************************************/
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <string>
#include <iostream>
FILE *fp;
char buff[51];
char *buff2;
char *buff3;
char *buff1[20];
string a[10];
string aa[10];
int result;
if( (fp = fopen( "c:\\table1.dat", "r" )) == NULL )
MessageBox(NULL,"The file was not opened","Message",MB_OK);
else
MessageBox(NULL,"The file 'data' was opened, Reading Data","Message",MB_OK);
int i=0;
while( !feof(fp))
{
fread( buff, sizeof( char ), 51, fp );
buff1=buff;
buff2=buff;
MessageBox(NULL,buff2,"message",MB_OK);
a=buff1;
aa[0]=a.substr(1,10);
aa[1]=a.substr(12,10);
aa[2]=a.substr(23,13);
aa[3]=a.substr(38,13);
//here i have to change these strings to chars.
//but it is giving error when i just do this
// buff3=aa[0]; Here could copy cahr to string but not in the other way. when i type cast wtih (char) also there it is giving error.
MessageBox(NULL,"We are in the file now","Message",MB_OK);
i++;
}
fclose( fp );
}
/********************************************************/
I am keeping this code in DLL.
thanks
Tiaac
tiaacus@yahoo.com
Please help me....
/**********************************************/
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <string>
#include <iostream>
FILE *fp;
char buff[51];
char *buff2;
char *buff3;
char *buff1[20];
string a[10];
string aa[10];
int result;
if( (fp = fopen( "c:\\table1.dat", "r" )) == NULL )
MessageBox(NULL,"The file was not opened","Message",MB_OK);
else
MessageBox(NULL,"The file 'data' was opened, Reading Data","Message",MB_OK);
int i=0;
while( !feof(fp))
{
fread( buff, sizeof( char ), 51, fp );
buff1=buff;
buff2=buff;
MessageBox(NULL,buff2,"message",MB_OK);
a=buff1;
aa[0]=a.substr(1,10);
aa[1]=a.substr(12,10);
aa[2]=a.substr(23,13);
aa[3]=a.substr(38,13);
//here i have to change these strings to chars.
//but it is giving error when i just do this
// buff3=aa[0]; Here could copy cahr to string but not in the other way. when i type cast wtih (char) also there it is giving error.
MessageBox(NULL,"We are in the file now","Message",MB_OK);
i++;
}
fclose( fp );
}
/********************************************************/
I am keeping this code in DLL.
thanks
Tiaac
tiaacus@yahoo.com