32 Replies - 1314 Views - Last Post: 02 October 2012 - 07:57 PM
#16
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 03:07 AM
#17
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 03:21 AM
#18
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 03:35 AM
#19
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 07:04 AM
Quote
Then maybe you'd be interested in this: Borland C++.
But I really suggest you save your money for something useful.
Jim
This post has been edited by jimblumberg: 02 October 2012 - 07:06 AM
#20
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:00 AM
And no, I'm not even considering buying it. After all this time, you still think I'd be stupid enough to actually buy something even remotely related to TC++?
#21
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:15 AM
Quote
Only 1 pound, must not contain all the manuals, should be closer to 6 pounds if all the manuals are present.
Quote
Nope.
Jim
#22
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:18 AM
#23
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:22 AM
I recommend you post your current code that illustrates your problems.
Jim
This post has been edited by jimblumberg: 02 October 2012 - 08:22 AM
#24
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:26 AM
#include <iostream.h>
#include <conio.h>
#include <fstream.h>
int main()
{
char c;
ofstream fout("C:\\USERS\\*****\\DESKTOP\\example.txt");
do
{
c=getch();
int a=c;
if(a==8)
{
cout<<"\b";
fout<<"\b";
}
else
{
fout<<c;
cout<<c;
}
} while(c!='`');
fout.close();
return 0;
}
This is the code that I am trying to run,..
The attached file is the output.
Attached File(s)
-
EXAMPLE.TXT (59bytes)
Number of downloads: 17
#25
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:32 AM
Here is a hexdump of your file.
00000000 54 68 65 20 71 75 69 63 6B 20 62 72 6F 77 6E 20 The quick brown 00000010 66 6F 78 20 6A 75 6D 70 65 64 20 6F 76 65 72 20 fox jumped over 00000020 74 68 65 20 6C 61 7A 79 20 64 6F 67 2E 08 08 08 the lazy dog.... 00000030 08 08 08 08 08 08 08 08 08 08 60 ..........`
The 0x08 is the proper value for the backspace character.
Jim
#26
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:35 AM
#27
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:39 AM
Jim
#28
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:46 AM
#29
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 08:55 AM
If you want to be able to enter the keys using getch() but be able to edit the entry you will need to implement your own buffer. You place the characters into the buffer but you don't write this buffer to the file until you are sure the entry is complete.
Until you are much more familiar with C/C++ I recommend you stick to the standard input output techniques, such as getline(), cin, cout.
Jim
#30
Re: question: How do I implement a basic CUI in c++?
Posted 02 October 2012 - 09:03 AM
|
|

New Topic/Question
Reply





MultiQuote



|