Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Multilanguage Resource compilation options Pin
Nelek23-May-07 20:56
protectorNelek23-May-07 20:56 
GeneralRe: Multilanguage Resource compilation options Pin
XtremDev23-May-07 21:21
XtremDev23-May-07 21:21 
GeneralRe: Multilanguage Resource compilation options Pin
Nelek23-May-07 21:26
protectorNelek23-May-07 21:26 
AnswerRe: Multilanguage Resource compilation options [modified] Pin
Naveen23-May-07 22:39
Naveen23-May-07 22:39 
GeneralRe: Multilanguage Resource compilation options Pin
tom groezer24-May-07 1:37
tom groezer24-May-07 1:37 
QuestionRun at .Net 2.0 (errors) Pin
Tal S.23-May-07 20:36
Tal S.23-May-07 20:36 
AnswerRe: Run at .Net 2.0 (errors) Pin
Hamid_RT24-May-07 0:50
Hamid_RT24-May-07 0:50 
GeneralRe: Run at .Net 2.0 (errors) Pin
Tal S.24-May-07 1:33
Tal S.24-May-07 1:33 
QuestionRe: Run at .Net 2.0 (errors) Pin
Hamid_RT24-May-07 10:53
Hamid_RT24-May-07 10:53 
AnswerRe: Run at .Net 2.0 (errors) Pin
Tal S.24-May-07 11:04
Tal S.24-May-07 11:04 
QuestionRe: Run at .Net 2.0 (errors) Pin
Hamid_RT24-May-07 11:14
Hamid_RT24-May-07 11:14 
AnswerRe: Run at .Net 2.0 (errors) Pin
Tal S.24-May-07 11:22
Tal S.24-May-07 11:22 
QuestionRe: Run at .Net 2.0 (errors) Pin
Hamid_RT24-May-07 11:28
Hamid_RT24-May-07 11:28 
AnswerRe: Run at .Net 2.0 (errors) Pin
Tal S.24-May-07 11:34
Tal S.24-May-07 11:34 
GeneralRe: Run at .Net 2.0 (errors) Pin
Hamid_RT24-May-07 11:50
Hamid_RT24-May-07 11:50 
QuestionRe: Run at .Net 2.0 (errors) Pin
Hamid_RT24-May-07 21:27
Hamid_RT24-May-07 21:27 
AnswerRe: Run at .Net 2.0 (errors) Pin
Tal S.26-May-07 9:10
Tal S.26-May-07 9:10 
AnswerRe: Run at .Net 2.0 (errors) Pin
Mark Salsbery24-May-07 7:28
Mark Salsbery24-May-07 7:28 
GeneralRe: Run at .Net 2.0 (errors) Pin
Tal S.24-May-07 8:54
Tal S.24-May-07 8:54 
GeneralRe: Run at .Net 2.0 (errors) Pin
Mark Salsbery24-May-07 8:57
Mark Salsbery24-May-07 8:57 
GeneralRe: Run at .Net 2.0 (errors) Pin
Tal S.24-May-07 9:02
Tal S.24-May-07 9:02 
QuestionHTTP send request Pin
deeps_cute23-May-07 20:23
deeps_cute23-May-07 20:23 
QuestionHow to write map to file? Pin
sandeepkavade23-May-07 20:13
sandeepkavade23-May-07 20:13 
hi all,

i want to write a map to a file and then read it again.
but while reading it is not wrorking(i think it is writing properly).

the map declaration is:
typedef map<int,logsettings> MapType;
typedef MapType::value_type ValuePair;

where LogSettings is a structure:

struct LogSettings
{
unsigned long dwSession;
TCHAR *szFilePath;
TCHAR *szInfection;
TCHAR *szAction;
TCHAR *szMessage;
TINFECTIONSTATE iAction;
};

where TINFECTIONSTATE is just a enum.

to write to a file th function is:
int DataToFile((LogSettings &lgsettings)
{
MapType Map;
Map.insert(ValuePair(1,lgsettings));
FILE* f = fopen("C:\\sample.txt","wb");
size_t n = fwrite(&Map,sizeof(Map),1,f);
fclose(f);
return (int)n;
}

while writing the sturcture is initialised to some values.

To read the map:

MapType Map1;
FILE* fd = fopen("C:\\sample.txt","rb");
size_t nm = fread(&Map1,sizeof(Map1),1,fd);
fclose(fd);
MapType::iterator iter = Map1.begin();
//while(iter !=Map1.end())
{
cout<<(*iter).first<
AnswerRe: How to write map to file? Pin
Cedric Moonen23-May-07 21:06
Cedric Moonen23-May-07 21:06 
AnswerRe: How to write map to file? Pin
Naveen23-May-07 21:13
Naveen23-May-07 21:13 

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.