944,005 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 5495
  • C++ RSS
Apr 12th, 2007
0

Print a file to Printer in DEV-C++

Expand Post »
I am trying to write a program to print a file to a printer.

havent gotten fery far till I started to go ary, here is the listing so far.

  1.  
  2. // This Program is to print a file listing with line numbers to Printer.
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <conio.h>
  6. int line = 0, page = 0;
  7.  
  8. int main( int argv, char *argc[] )
  9. {
  10. char buffer[256];
  11. FILE *fp;
  12. printf("Enter File Name.\n ");
  13.  
  14. scanf("filename.ext" );
  15.  
  16. printf("%d",filename.ext "\n" );
  17.  
  18. system( "PAUSE" );
  19.  
  20. return 0;
  21. }

I'm thinking that the SCANF is not capturing the filename.ext thier for

ofcourse it will not print is the following statement.

any assistance would be greatly Appreciated.

Thank you

Dick
Last edited by WaltP; Apr 13th, 2007 at 1:21 am. Reason: Fixed CODE tags -- nice try but no cigar! See that PREVIEW button? It helps
Similar Threads
CRD
Reputation Points: 10
Solved Threads: 0
Light Poster
CRD is offline Offline
31 posts
since Apr 2007
Apr 13th, 2007
0

Re: Print a file to Printer in DEV-C++

> scanf("filename.ext" );
What is this line supposed to do?
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Apr 13th, 2007
0

Re: Print a file to Printer in DEV-C++

it is to capture input of a filename & extention
from the keyboard.

Dick
CRD
Reputation Points: 10
Solved Threads: 0
Light Poster
CRD is offline Offline
31 posts
since Apr 2007
Apr 13th, 2007
0

Re: Print a file to Printer in DEV-C++

And how does scanf know where to put this captured data?
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Apr 13th, 2007
0

Re: Print a file to Printer in DEV-C++

When was the last time you looked at the format of a scanf() command? And while you're at it, read this about scanf()
Moderator
Reputation Points: 3278
Solved Threads: 894
Posting Sage
WaltP is offline Offline
7,747 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Pointers
Next Thread in C++ Forum Timeline: making a project file using classes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC