Again C++ question

Muhammad Rizwan rizwan at advcomm.net
Sat Mar 26 14:37:47 GMT 2005


Hello

I was using kdevelop 2.XX one month ago, and write some code related to
file handling as:

	int fd;
	if( (fd = open("file.txt", O_WRONLY | O_CREAT, 0640 ) == -1 )
	{
		Logging(strerror(errno), 0, ConfigData.Folder);
		return(-1);
	}
	struct flock lockp;
	lockp.l_type = F_WRLCK;
	lockp.l_whence = SEEK_SET;
	lockp.l_start = 0;
	lockp.l_len = 0;
	if( fcntl (fd, F_SETLK, &lockp) == -1 )
	{
		Logging(strerror(errno), 0, ConfigData.InsFolder);
		close(fd);
		return(-1);
	}
	ofstream outFile(fd);
	outFile << "text here";
	close(fd);

I was compiling this program successfully in kdevelop 2.XX, but now i
have updated my kdevelop version to 3.0 and i am getting errors for file
descriptors i.e. fd.
Now which function should i use to open file which 'll return me file
descriptor, so that i 'll be able to lock file by using fcntl(). Because
fcntl() accepts file descriptor (i.e. fd) as:

fcntl (fd, F_SETLK, &lockp)

Any idea?

Thanks


-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list