954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Print a file to Printer in DEV-C++

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.

// This Program is to print a file listing with line numbers to Printer.
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int line = 0, page = 0;
   
int main( int argv, char *argc[] )
{
    char buffer[256];
    FILE *fp;
    printf("Enter File Name.\n ");
    
    scanf("filename.ext" );
    
    printf("%d",filename.ext "\n" );
    
    system( "PAUSE" );
    
    return 0;
}


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

CRD
Light Poster
31 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

> scanf("filename.ext" );
What is this line supposed to do?

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

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

Dick

CRD
Light Poster
31 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

And how does scanf know where to put this captured data?

John A
Vampirical Lurker
Team Colleague
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
 

When was the last time you looked at the format of a scanf() command? And while you're at it, read this about scanf()

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You