> >If i start the program now 1,3,8 will be placed i my textfile. If i then
run
the program again i need to save the old data, so i will have the program
tojump to the nextline.
ofstream session_fil("session.txt");
ofstream session_fil ("session.txt", ios_base::app);
I then get the errors:
error C2653: 'ios_base' : is not a class or namespace name
error C2065: 'app' : undeclared identifier
Can you help more :o)
Thanks
**************************
All my kode
**************************
#include <iostream.h>
#include <afxwin.h>
#include <fstream.h>
class Protokol
{
private:
CString modtaget;
public:
Protokol(CString modtag)
{
modtaget=modtag;
}
void tilInt()
{
CString data=modtaget; //data = 138
int length=data.GetLength(); // length=3
int *values=new int[length];
for (int i=0; i<length; i++)
{
char chardata=data.GetAt(i); // '1'
int intdata= chardata-'0';//konvertering til int
values[i]=intdata;
cout<<values[i]<<endl;
ofstream session_fil ("session.txt", ios_base::app);
session_fil<<values[i]<<endl;
}
ofstream session_fil("session.txt");
for (int j=0; j<length; j++)
{
session_fil<<values[j]<<endl;
}
}
};