Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys, I am now trying to make a border for my program and i've been doing my research on how to do so, I haven't tried coding 1 as of yet but just a quick question.
Do i define Height and Width? Would that also help me with the gotoXY?
Just trying to do a simple border for now like asterisks.

What I have tried:

Thank you very much for the help.
Richard MacCutchan 26-Sep-17 7:48am    
If you are using the basic gotoXY statements then you need to know the window height and width to start with.
Member 13396113 26-Sep-17 10:22am    
can i declare the height and width of the window for that matter ?
Richard MacCutchan 26-Sep-17 10:30am    
Member 13396113 26-Sep-17 11:02am    
But isn't gotoXY (rows, columns) or is that the same thing with height and width?
Richard MacCutchan 26-Sep-17 11:18am    
Well you need to know how high and wide your window is before setting the values of X and Y. But to be honest, this is all a waste of time. You would be better learning how to create proper GUI based applications.

1 solution

We can't really help, based on that little information.
Standard C doesn't have any really useful output instructions, just printf - so you can't write generic code to move the cursor to a specific point, or write a character at any point other than where the cursor is. Which makes adding a border in a console type application (which from the "asterisks" is what you are trying to do) really rather difficult, if not totally impractical (in that you would have to repaint the entire screen each time anything changed, even a single character).

It may be that the specific compiler /operating system you are using may include library functions to do that, but we have no idea what system you are using, so we can't comment!
So start by finding out what your compiler provides in the way of display manipulation functions, and look for examples of them in use.
Share this answer
Member 13396113 26-Sep-17 11:04am    

Oh I can see what you mean about it being impractical since the screen changes everytime something happens. And characters would just overlap and all that.

I'm using DevC++ 5.11 and running on Win10 64-bit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900