Papers     Signup     Site Map     Support     Directory  

Search Doing My Homework Papers


Papers > Science > pfuncs


This is a preview of a paper to view the full text you need to signup and login.

pfuncs

/* Functions to read and write PNM files. Written for use in a Computer Vision course. Copyright (C) 2002 Lior Okman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "pfuncs.h" /* Declare the actual headers */ static const char MAGICNUMBERS[6][3] = { "P1" , "P2", "P3", "P4", "P5", "P6" }; /* Some local functions (see comment before each function for information) */ static int read_pfile_header(FILE *inPictureFile, tPfile *outPicture); static int read_pfile_binary_data(FILE *inPictureFile, tPfile *outPicture); static int read_pfile_ascii_data(FILE *inPictureFile, tPfile *outPicture); static int write_pfile_header(FILE *inPictureFile, tPfile *inPicture, const char *inComment, int inSaveRaw); static int write_pfile_binary_data(FILE *inPictureFile, tPfile *inPicture); static int write_pfile_ascii_data(FILE *inPictureFile, tPfile *inPicture); /* read_pfile * Parameters: inFileName - the filename to read * outPicture - Pre-allocated structure that will be filled. * Returns : PFUNCS_TRUE/PFUNCS_FALSE for success/failure * Remarks : outPicture should be allocated before calling this function, * but outPicture->Data will be malloc`ed here. Remember to free * the memory when finished with it by calling free_pfile. The * previous contents of outPicture->Data will be destroyed. You * have been warned. */ int read_pfile( const char *inFileName, tPfile *outPicture) { FILE *PictureFile = NULL; int RetVal; /* Sanity check and try to open the file */ if (!inFileName || !outPicture || !(PictureFile = fopen(inFileName, "rb"))) { return PFUNCS_FALSE; } /* Read the header*/ RetVal = read_pfile_header(PictureFile, outPicture); /* Get the data - NOTE: this destroys the pointer outPicture->Data.

To link to this page, copy the following code to your site:


Paper Information

Title: pfuncs

Words: 1567
Rating: None
Pages: 6.3
submitted by: inbarit

If you think this paper shouldn't be here then

Signup & Login

If you don't currently have a login then Signup here



Username:

Password:

Pre-Written Papers
Browse through professionally written papers!

Browse through professionally written papers!

Custom Papers
Have Professional writers do your homework!

Professional writers will write custom papers for you!


Copyright 2003-2008 doingmyhomework.com. All rights reserved.