Essay Samples

HOME F.A.Q. REGISTER LOGIN SEARCH  
Essay Topics
Acceptance
Art
Business
Custom Written
Direct Essays
English
Example Essays
Foreign
History
Medical
Mega Essays
Miscellaneous
Movies
Music
Novels
People
Politics
Pre-Written
Religion
Science
Search
Speeches
Sports
Technology
Over 101,000 Essays and Term Papers!!
This is only a preview of the paper
Click here to register and get the full text.
Existing members click here to 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. * Make sure that nothing important is in it before you call this function */ if (RetVal && (RetVal = alloc_pfile(outPicture))) { if (IS_BINARY(outPicture->PicType)) { RetVal = read_pfile_binary_data(PictureFile, outPicture); } else { RetVal = read_pfile_ascii_data(PictureFile, outPicture); } } fclose(PictureFile); return RetVal; } /* write_pfile * Parameters: inFileName - The intended filename.


Approximate Word count = 1567
Approximate Pages = 6.3
(250 words per page double spaced)
Over 101,000 Essays and Term Papers!!
Links
pfuncs

Support
F.A.Q.
Custom Essays
Payment
Essay Samples
Forgot Password?
Activation Email
More Links
All Papers Are For Research And Reference Purposes Only! You may not turn these papers in as your own! You must cite our web site as your source!
Copyright 2003-2008 essaysamples.net. All rights reserved.