Thread: Help with printing something

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    8

    Help with printing something

    My book says you can print something using stprn. So I wrote the following program but I get errors when I compiler. It is on the line with fprintf.

    #include <stdio.h>

    int main()
    {
    char array [100];
    printf("Enter string to be printed\n\n");

    fgets( array, 100, stdin);
    fprintf(stdprn, array);
    system("pause");
    return 0;
    }

    how do I make this go to the printer? Any help would be appreciated.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > So I wrote the following program but I get errors

    Usually if you get errors, it's a good idea to actually tell us what errors you're getting. How the hell am I supposed to know what your specific computer and compiler are producing?

    I suppose I can guess...

    You never open 'stdprn'.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Code:
    int printy(char *strp)
    {
     file *pp = fopen("LPT1","w");
     fprintf(pp,"%s\f",strp);
     return 0;
    }
    usage: printy("Hi, I'm printing stuff out!");

  4. #4
    Unregistered
    Guest
    Your fprinf is wrong it should be:
    fprintf(stdprn, "%s", arrayname);

  5. #5
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    \f = formfeed.

    newbie.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# Printing Problem
    By silverlight001 in forum C# Programming
    Replies: 0
    Last Post: 03-23-2009, 01:13 AM
  2. generic printing preferences dialog box
    By stanlvw in forum Windows Programming
    Replies: 8
    Last Post: 06-27-2008, 02:20 AM
  3. printing data to a file
    By coralreef in forum C Programming
    Replies: 3
    Last Post: 11-02-2006, 08:10 PM
  4. need help relating printing?
    By omarlodhi in forum Linux Programming
    Replies: 0
    Last Post: 03-03-2006, 04:46 AM
  5. Printing
    By Dual-Catfish in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 05-25-2002, 08:10 PM