Mail Archives: cygwin/2001/07/22/16:53:19
------=_NextPart_000_0001_01C112F8.69E3A300
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hello and thanks for your time.
I have been subscribed to this list now for 1824 posts but this is my
first post.
I have a file (attached) which I can't compile under cygwin using gcc.
Is it possible for this file to be compiled using cygwin, and if so can
you point me to where I am going wrong? Sorry if this is a REALLY dolly
question but we all start somewhere. PS This code compiles fine under
VC6.
I get these errors when I compile using the command directly below
$ gcc byte_hacking.cpp
byte_hacking.cpp: In function 'int main():
byte_hacking.cpp:20 implicit declaration of function 'int lseek(...)'
byte_hacking.cpp:22 implicit declaration of function 'int read(...)'
byte_hacking.cpp:27 implicit declaration of function 'int write(...)'
byte_hacking.cpp:25 implicit declaration of function 'int close(...)'
Thanks lots
David Ayliffe (mail AT ayliffe DOT com)
Running Windows 2000 Advanced Server (SP2) with Cygwin gcc 2.95.3-5
Also running Suse Linux 7.1 Professional kernel 2.4
<ATTATCHED CODE FOR THOSE WHO CANT BE BOTHERED TO OPEN THE ATTACHMENT>
//Gets records from a MS Access Database
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys\stat.h>
//#define database = northwind.mdb;
int main ()
{
int f,buf;
int isuccess = 0;
printf ("Lists records in database\n");
printf ("**************************\n\n");
if (chmod("northwind.mdb",S_IWRITE)!=-1 && (f=open
("northwind.mdb",O_RDWR | O_BINARY))!=-1)
{
//handle, offest, origin
if (lseek (f,0,SEEK_SET)!=1)
{
if (read (f,&buf,2)==2 && buf==0x037D)
{
printf ("Reading records");
lseek (f,346345,SEEK_SET);
buf=0x9090; //nop nop
if (write(f,&buf,2)==2)
{
printf ("Success.");
}
else
{
printf ("Failed due to unknown
reason.");
}
}
else
{
printf("Cannot find start location.
File may not be .mdb file");
}
}
else
{
printf("Seek error.");
}
close(f);
}
else
{
printf ("Cannot find northwind.mdb");
}
return isuccess;
}
<END OF ATTATCHED CODE FOR THOSE WHO CANT BE BOTHERED TO OPEN THE
ATTACHMENT>
------=_NextPart_000_0001_01C112F8.69E3A300
Content-Type: application/octet-stream;
name="byte_hacking.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="byte_hacking.cpp"
//Gets records from a MS Access Database
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys\stat.h>
#define database =3D northwind.mdb;
int main ()
{
int f,buf;
int isuccess =3D 0;
printf ("Lists records in database\n");
printf ("**************************\n\n");
if (chmod("northwind.mdb",S_IWRITE)!=3D-1 && (f=3Dopen =
("northwind.mdb",O_RDWR | O_BINARY))!=3D-1)=20
{
//handle, offest, origin =09
if (lseek (f,0,SEEK_SET)!=3D1)=20
{
if (read (f,&buf,2)=3D=3D2 && buf=3D=3D0x037D)=20
{
printf ("Reading records");
lseek (f,346345,SEEK_SET);
buf=3D0x9090; //nop nop
if (write(f,&buf,2)=3D=3D2) =20
{=09
printf ("Success.");
}
else=20
{
printf ("Failed due to unknown reason.");
}
}=20
else=20
{ =09
printf("Cannot find start location. File may not be .mdb file");
}
}=20
else=20
{
printf("Seek error.");
}
close(f);
}=20
else=20
{
printf ("Cannot find northwind.mdb");
}
return isuccess;
}
------=_NextPart_000_0001_01C112F8.69E3A300
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------=_NextPart_000_0001_01C112F8.69E3A300--
- Raw text -