Originally posted by Shadow
Code:
/*

	Program:
	Printer.c
	
	Purpose:
	Demonstrates how to use the printer
	in your programs.
	
*/

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	 FILE *printer = fopen("LPT1","w");
	 FILE *fp;
	 char str[256];
	 char buf[BUFSIZ];
	 printf("File name?\n ");
	 scanf("%s",str);
	 fp = fopen(str,"r");
	 if(!fp)
	 {
	 	printf("File does not exist\n");
  		return -1;
 	 }
 	 while( fgets(buf,sizeof buf,fp) != NULL ) 
	 {
	 	printf("\nPrinting..\n");
  	       	fprintf(printer,"%s",buf);
	 }

 	 fprintf(printer,"\f");
         return 0;
}
....if any of that helps.
To answer the reply prior to this one, what do you mean by "do I have a file in my directory called 'LPT1'? Do you mean a file in my program or on my computer? My printer file on my computer is Lexmark....but it is conected via 'LPT1' port. Do I need to create a file in my program called 'LPT1'? If so what is the purpose?

The sample code you just sent me is the same sample I started with. The problem with this is that what I'm trying to do is search my 'client.dat' file which holds strutures containing 'client code'. When it finds the client code, I want to print that structure out on paper. Hers is how I've modified it so far:
Code:
/************************************************************/
char print_label (void)
/*
  Task: Prints shipping information
*/
/************************************************************/
{
	FILE *printer;
	FILE *dta_file;
	char buf[BUFSIZ];
	int user_inputted_client_code;
	clrscr();
	printf("\t\t\tClient Inventory Management \n\n\n");
	printf("\tPrint Client Label \n\n");
	printf("Client Code: ");
	scanf("%d",&user_inputted_client_code);
	if((dta_file=fopen(FILENAME,"rb")) == NULL)
	{
		perror(FILENAME);
		return(1);
	}
	if((printer = fopen("LPT1","w")) == NULL)
	{
		perror("LPT1");
		return (1);
	}
	while((fread(&another_client,sizeof(struct fclient),1,dta_file)) == 1)
	{
		if(user_inputted_client_code == another_client.client_code)
		{
			fgets(buf,sizeof buf,dta_file);
			while( fgets(buf,BUFSIZ,dta_file) != NULL )
			{
				//	fprintf(printer,"printclient2(&another_client)",buf);
				fprintf(printer,"buf");
				fprintf(printer,"\f");
			}
			//fprintf(printer,"buf");
			//fprintf(printer,"\f");
		}
	}
	if(!dta_file)
	{
		printf("File does not exist\n");
		return -1;
	}
    fclose(dta_file);
	key_wait();
	return 0;
}
/*HERE IS THE INTERNAL FUNCTION BEING CALLED*/
/************************************************************/
int printclient2 (struct fclient *client)
/************************************************************/
{
	printf ("Client Code: %d\n\n", client->client_code);
	printf ("Client Name: %s\n", client->clientname);
	printf ("Street Address: %s\n", client->street_address);
	printf ("City: %s\n", client->city);
	printf ("Province or State: %s\n", client->pros);
	printf ("Country: %s\n", client->country);
	printf ("Postal or Zip Code: %s\n\n\n", client->postalorzip_code);
	return(1);
}
Some things are commented out for now because I was trying different options. Also, I didn't think I had any use for 'char str[256]' where as I'm searching for an 'int client_code'. I'm totally stumped.
All suggestions welcome, but I would prefer keeping the program the same without having to make drastic changes. I need to have this working by tommorrow night at the latest or it's my ass!
Thx.