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

Recommended Answers

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

Jump to Post

All 4 Replies

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

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

Dick

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.