paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-users] Pg_File simple demo


From: Roger D. Vargas
Subject: [paragui-users] Pg_File simple demo
Date: Thu, 11 Jul 2002 15:21:15 -0400 (CDT)

After half an hour of work i finished this simple demo for writing files
using PG_File. I think it can be added to the tutorials and documentation.


/**********************************************************
This is a simple PG_File demo that writes 2 ints to a file
Roger D. Vargas
**********************************************************/
#include <pgfilearchive.h>
#include <pgfile.h>
#include <pglog.h>
#include <string>

main()
{
 PG_FileArchive *Arc;
 PG_File *wf;
 int v1=23444,v2=44566;
 //Create the FileArchive object
 Arc = new PG_FileArchive();
 //Set the base app dir as write dir
 Arc->SetWriteDir(PG_FileArchive::GetBaseDir());
 //Now open a file for writing
 wf = Arc->OpenFile("test", PG_OPEN_WRITE);
 //Now write a couple of ints
  wf->write(&v1,sizeof(v1));
 wf->write(&v2,sizeof(v2));

}

I'm still novice with c, so if there are any mistake or addition, please
feel free to correct it.


--
Roger D. Vargas         | El sistema se apagara en 5 segundos.
ICQ: 117641572          | Salvese el que pueda!
Linux User: 180787      |




reply via email to

[Prev in Thread] Current Thread [Next in Thread]