Thread: Printing problem

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001

    Printing problem

    In my program, it prints the arry called buff, but it doesn't reconise the \n escape sequaence in my char array. Heres my program (AGAIN!), and can you please tell me whats wrong.


  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Sorry, forgot to upload it ...

  3. #3
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    I don't think that's gonna work. For each line you need to call the TextOut function:
    if(StartDoc(pd.hDC,&di)>0 && StartPage(pd.hDC)>0)   //new page
        TextOut(pd.hDC,100,100,"Line 1", 6);
        TextOut(pd.hDC,100,200,"Line 2", 6);
        TextOut(pd.hDC,100,300,"Line 3", 6);
        TextOut(pd.hDC,100,400,"Line 4", 6);
        TextOut(pd.hDC,100,500,"Line 5", 6);
        EndPage(pd.hDC);      //end of page
        EndDoc(pd.hDC);       //end of doc
    Maybe there are other (more simple) solutions but I can't think of one.

  4. #4
    train spotter
    Join Date
    Aug 2001
    near a computer
    >>TextOut(pd.hDC,100,100,"Line 1", 6);

    TextOut(pd.hDC,100,100,"Line 1", lstrlen("Line 1")); // safer to use


    One thing you could try as it cuts down on code.

    When you have a lot of similar controls (like your edits for the days) it can be handy to use loops to deal with them. ie use a loop to clear them all.

    To do this I edit 'resource.h' . Find the edit contols (ie #define MON_ONE 1000) and put them in numerical order. Or use consecutive ID when creating them.

    #define MON_ONE 1001
    #define MON_TWO 1002 ect (or TUE_ONE ??)

    then in a header define a start for the loops and number of loops.
    #define FIRST_EDIT 1001//id of first edit MON_ONE
    #define NUM_EDIT 7 //number of loops / controls

    then you can
         SetDlgItemText(hWnd,(FIRST_EDIT+i),"Some Text");//the resource ID is an int cast, so substituting an int works
    Now match an array of data's indexes to the edit's index and you have easy way to update you dialog.

    char     sEditBuffers[NUM_EDIT][64];
    Something you could try.....
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Try using \r\n. I had this problem in VC6, but just \n works for me in .NET but so does \r\n so i just stick to that since thats what im used to.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

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. Problem Printing to File
    By jamez05 in forum C++ Programming
    Replies: 10
    Last Post: 09-26-2006, 11:20 AM
  3. Replies: 1
    Last Post: 06-07-2006, 09:42 AM
  4. Message printing problem
    By robert_sun in forum C Programming
    Replies: 1
    Last Post: 05-18-2004, 05:05 AM
  5. problem with printing a structed array using for loop
    By Prezo in forum C++ Programming
    Replies: 2
    Last Post: 09-15-2002, 09:00 AM