Thread: print a picture

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    33

    print a picture

    Hey all, anyone knows how can I print a picture in c++;
    CAN U GIVE ME A CODE? A SAMPLE?

    THANKS

  2. #2
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Print?
    Do you mean, using printer?

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    33
    edited

  4. #4
    Registered User
    Join Date
    May 2008
    Posts
    33
    yes using printer..

    print a picture using printer, c++ code

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    33
    Ubuntu, gcc compiler..

  6. #6
    Registered User
    Join Date
    May 2008
    Posts
    33
    can I get a sample code that does this!

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by moussa View Post
    can I get a sample code that does this!
    Probably, if you Google for it.

  8. #8
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Tell us, which Operating System and C++ compiler you are using?
    It will help others to suggest you an easy solution.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    This is platform specific, unfortunately, since C++ has no library for that.
    What are you developing for? Windows, Linux, Mac?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    May 2008
    Posts
    33
    I already googled, didnt find anything.

    can i just like windows , call system(print watever..)


    how it works in linux?

  11. #11
    Registered User
    Join Date
    May 2008
    Posts
    33
    FILE * fpPrint; // file handle for printing
    fpPrint = fopen( "PRN:" ); // open the printer port
    fprintf( fpPrint, "testing" ); // write to the printer
    fclose( fpPrint ); // close the printer port

    this code aint enough

  12. #12
    Registered User
    Join Date
    May 2008
    Posts
    33
    I Want To Print A Picture

  13. #13
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by moussa View Post
    I Want To Print A Picture
    Printing pictures is absolutely not trivial. In a Linux/Unix world, you'd probably be best off trying to form the image as a PostScript document first, then use the standard printing processing. Of course, that's probably a few hundred lines of code at the very least, quite likely more into the early thousands.

    The simplest way to print something in Linux would be to load it into an existing application and use it's print function - it allready has the code to do that.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  14. #14
    Registered User
    Join Date
    May 2008
    Posts
    33
    Quote Originally Posted by matsp View Post
    Printing pictures is absolutely not trivial. In a Linux/Unix world, you'd probably be best off trying to form the image as a PostScript document first, then use the standard printing processing. Of course, that's probably a few hundred lines of code at the very least, quite likely more into the early thousands.

    The simplest way to print something in Linux would be to load it into an existing application and use it's print function - it allready has the code to do that.

    --
    Mats

    plz can u show me the code.thx

  15. #15
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Quote Originally Posted by moussa View Post
    plz can u show me the code.thx
    No, he's not - nor is anyone else - going to write it for you. He just said it's a very complicated process. What makes you think people have time to dedicate to spoon feeding you a program?

    At the very least you have to a) find a library that provides this functionality, and b) link with that library and use it in your program. And no, I'm not going to post an example.
    Last edited by medievalelks; 05-28-2008 at 06:16 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to print an array like in this picture..
    By transgalactic2 in forum C Programming
    Replies: 20
    Last Post: 01-03-2009, 08:28 AM
  2. merging linked lists
    By scwizzo in forum C++ Programming
    Replies: 15
    Last Post: 09-14-2008, 05:07 PM
  3. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  4. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  5. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 08:13 PM