Thread: Need hlep with program output...fast!!

  1. #16
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    i checked it again its indeed a warning but u can compile it heres an example
    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <time.h>
    
     int main()
     {
    	int textcolor();
    
    		textcolor(BLUE);
    		printf("This should be in blue...\n");
    
    		sleep(1500);
    		textcolor(GREEN);
    		printf("And this is in GREEN");
    		sleep(2000);
    	return 0;
    	}
    the error given is => warning declaration of textcolor does not match previous declaration at (and then the place where conio.h is stored)
    to show it works ill put it in a zip file so i dont know what your problem is but ill ad the zip file ...

  2. #17
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    Give this a try with the turbo compiler, but don't waste your time with lccwin32 unless you like general protection faults.

    Code:
    // compiled using TC 3
    
    #include <stdio.h>
    
    typedef unsigned char tiny;
    
    void paintBG(tiny);
    
    int main(void)
    {
      paintBG('\x1E');
      printf("I'm now a yellow text string on a blue back ground.\n");
    
       return 0;
    }
    
    void paintBG(tiny color)
    {
      // never understood why Borland refuses to make use of
      // asm{  inline code } though it lists it as such in its
      // help file.  go figure.
      
      _asm mov ah,0x02
      _asm xor bh,bh
      _asm mov dl,0
      _asm mov dh,0
      _asm int 0x10
    
    
      _asm mov ah,0x09
      _asm xor bh,bh
      _asm mov cx,2000
      _asm mov al,' '
      _asm mov bl,color
      _asm int 0x10
    
      // if I were using my MS dos compiler, this would be so much easier. :P
    
    }
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  3. #18
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    Oh, it seems to me that the post of GanglyLamb should work in Turbo provided that you add

    Code:
    #include <stdio.h>
    #include <conio.h>
    
    #define BLUE 1
    
    int main(void)
    {
    
      textcolor(BLUE);
      return 0;
    
    }
    Dunno about lccwin32 though.... I've never had a reason to use it.
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  4. #19
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    i think i know what nukesquad his problem was in lcc win32
    this works
    [code]
    #include <stdio.h>
    #include <conio.h>

    int main()
    {

  5. #20
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    damn sry wrong button
    so this is what i think he did
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    		int main()
    		{
    			int textcolor();
    			textcolor(BLUE);
    			printf("This is in blue");
    
    			return 0;
    		}
    this way it gives a warning but you can compile
    BUt this way u cant compile it what is very logic actually
    Code:
    #include <stdio.h>
    #include <conio.h>
    		int textcolor();
    		int main()
    		{
    
    			textcolor(BLUE);
    			printf("This is in blue");
    
    			return 0;
    		}

  6. #21
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    Originally posted by GanglyLamb
    Code:
    BUt  this way u cant compile it what is very logic actually
    
    #include <stdio.h>
    #include <conio.h>
    
    int textcolor();
    int main(void)  <--  add void here so not to confuse the poor thing
    {
    
      textcolor(BLUE);
      printf("This is in blue");
    
     return 0;
    }
    I dunno how that function is defined in conio.h for lccwin32, but the code above expects an int to be returned from the prototype

    Code:
    int textcolor(); // funct prototype
    
    //really this should be int textcolor(void);
    However, you're calling the funct like

    Code:
    textcolor(BLUE);
    
    int aColor;
    aColor = textcolor(); // is what the prototype expects
    I'd imagine that you'd want

    Code:
    void textcolor(COLOR);
    where COLOR is defined in conio.h. I'm only guessing there though... like I said, I've not used lccwin32.
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  7. #22
    Registered User
    Join Date
    Oct 2002
    Posts
    8
    Well, basically everything works in Turbo C.

    Problem arises when I try to run it in lccwin32. Dunno how you did it GanglyLamb...but my lccwin compiler gave me an Error...not a warning. There is no executable file generated at all.

    Its always about the same thing. Undefined "_textcolor" (note the underscore) or that the declaration of textfile does not match the original declaration at tcconio.h.

    Note that this is the error I'm getting from lccwin32. Why does the lccwin makes a reference to a turbo c header file I have no idea.

    I'm starting to think that my conio.h file is corrupted or something. Maybe Ganglylamb would be kind enough to post his copy of the conio.h file here? =)

    Thanks all for the effort though...

  8. #23
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    ill post it right away firtsthing first and thta ll be dinner

  9. #24
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110

    Angry

    :d here it is

  10. #25
    Registered User
    Join Date
    Oct 2002
    Posts
    8

    Talking

    Thanx ganglylamb....will keep you posted.

    btw...I'm assuming that the textbackground functions work the same way?

  11. #26
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Make sure you read this.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  12. #27
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    *textbackground also works with this
    * reply to Hammer=>if a header is corrupted and ive got the right header and nukesquad wanted it whats the prob then after all lcc-win32 is shareware and the header is used in lcc so ...

  13. #28
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by GanglyLamb
    if a header is corrupted and ive got the right header and nukesquad wanted it whats the prob then after all lcc-win32 is shareware and the header is used in lcc so ...
    Nothing, as long as it's the same compiler (including version of). It's unusual for headers files to get corrupted, unless someone has had their fingers in them and saved changes by mistake Personally, I'd probably download the latest version and re-install, that way you can be sure everything is straight.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  14. #29
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    oke from this day forward i shall NEVER ...never do this thing again without asking version etc coz ur right at some point i guess
    grtz
    LAmb

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Redirecting program output straight to an edit control
    By bennyandthejets in forum C++ Programming
    Replies: 5
    Last Post: 07-05-2004, 08:25 AM
  4. Program Output
    By lavon in forum C Programming
    Replies: 1
    Last Post: 03-19-2002, 10:32 PM
  5. Program Output
    By lavon in forum C Programming
    Replies: 1
    Last Post: 03-19-2002, 10:30 PM