This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Probably a very simple problem - hopefully someone will help me


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@ayliffe.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>

byte_hacking.cpp

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]