8 Replies - 3744 Views - Last Post: 24 February 2012 - 12:21 PM Rate Topic: -----

#1 mr_mohamed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-February 12

clreol();

Posted 24 February 2012 - 09:41 AM

Hi guys,
I am having a trouble with creating a clreol(); (clear end of line) function in C language. And also I am using Devc++. Can any one please provide the source code of this header file?
Is This A Good Question/Topic? 0
  • +

Replies To: clreol();

#2 vividexstance  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 651
  • View blog
  • Posts: 2,240
  • Joined: 31-December 10

Re: clreol();

Posted 24 February 2012 - 09:45 AM

This isn't a homework writing service, you need to show some effort before anyone here is going to help you. Just think about the problem and what you're trying to do. Usually, the console size is 80 characters wide by 24/25 lines. So all you really need to do is to output the correct number of newlines: '\n' to the screen and it should be cleared out.
Was This Post Helpful? 0
  • +
  • -

#3 jimblumberg  Icon User is offline

  • member icon


Reputation: 4002
  • View blog
  • Posts: 12,346
  • Joined: 25-December 09

Re: clreol();

Posted 24 February 2012 - 09:45 AM

What header file are you talking about? Normally, if this non-standard function exists, you would just include the proper header file. However this function is not available with most modern compilers, it was only available with an old outdated, obsolete compiler, which I will not name.

Jim
Was This Post Helpful? 0
  • +
  • -

#4 mr_mohamed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-February 12

Re: clreol();

Posted 24 February 2012 - 10:07 AM

View Postjimblumberg, on 24 February 2012 - 09:45 AM, said:

What header file are you talking about? Normally, if this non-standard function exists, you would just include the proper header file. However this function is not available with most modern compilers, it was only available with an old outdated, obsolete compiler, which I will not name.

Jim

in conio.h library there are no clreol.c functions. So I'm trying to create a header file for the clreol(); function. I've got some other header source codes but it seems like not working.
Here is the codings I got through the net
#include <conio.h>

 
void clreol (void)
{
     if (!ConioInitialized)
        textmode(LASTMODE);
        wclrtoeol(CurrentWindow);
        wrefresh(CurrentWindow);
}

Was This Post Helpful? 0
  • +
  • -

#5 vividexstance  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 651
  • View blog
  • Posts: 2,240
  • Joined: 31-December 10

Re: clreol();

Posted 24 February 2012 - 10:17 AM

Did you not read the last line of jimblumberg's post? The header file you're trying to use is very old and outdated. It's also non-portable so you shouldn't get used to using it. Just come up with your own function. This wouldn't be that hard of a function to write. You just need to output the correct number of newlines.
Was This Post Helpful? 1
  • +
  • -

#6 jimblumberg  Icon User is offline

  • member icon


Reputation: 4002
  • View blog
  • Posts: 12,346
  • Joined: 25-December 09

Re: clreol();

Posted 24 February 2012 - 11:25 AM

Actually I was talking about the function, not the header file. The conio.h header file is still supplied by most of the current Windows compilers. This function, however is not supplied by most of these modern Windows compilers (I'll even include the outdated Devc++ as modern).

I do agree that the use of the conio.h header file should be discouraged for most usages. I also agree that this header is non-portable, it only works for a Windows console program.

Jim

This post has been edited by jimblumberg: 24 February 2012 - 11:25 AM

Was This Post Helpful? 1
  • +
  • -

#7 mr_mohamed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-February 12

Re: clreol();

Posted 24 February 2012 - 11:53 AM

View Postjimblumberg, on 24 February 2012 - 11:25 AM, said:

Actually I was talking about the function, not the header file. The conio.h header file is still supplied by most of the current Windows compilers. This function, however is not supplied by most of these modern Windows compilers (I'll even include the outdated Devc++ as modern).

I do agree that the use of the conio.h header file should be discouraged for most usages. I also agree that this header is non-portable, it only works for a Windows console program.

Jim

Yes Jim you are right. And I was trying to create my own program, and I had to clear the end line of the printf(); statement so I searched for it and got the option called clreol(); and it normally included in the conio.h library. Since I am using DevC++ not all of the functions those are available in conio.h are accessible(But I earlier used turbo C and it worked well). Only few functions are accessible, such as getch(); . Since I am an Beginner - Intermediate programmer I have to go through some more books and sources again.
so, can you please suggest some books and sources for my studies Jim?
Was This Post Helpful? 0
  • +
  • -

#8 jimblumberg  Icon User is offline

  • member icon


Reputation: 4002
  • View blog
  • Posts: 12,346
  • Joined: 25-December 09

Re: clreol();

Posted 24 February 2012 - 12:18 PM

You may want to look at the topic in the C++ discussion forum for a list of Book recommendations. There are quite a few good recommendations such as this Book list provided by Salem_c in post #4.

Jim
Was This Post Helpful? 0
  • +
  • -

#9 mr_mohamed  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-February 12

Re: clreol();

Posted 24 February 2012 - 12:21 PM

View Postjimblumberg, on 24 February 2012 - 12:18 PM, said:

You may want to look at the topic in the C++ discussion forum for a list of Book recommendations. There are quite a few good recommendations such as this Book list provided by Salem_c in post #4.

Jim

Thank you Jim :)
have a nice day
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1