Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help!!! Escape sequences in C++ on windows XP

Status
Not open for further replies.

Lucifre

Full Member level 2
Full Member level 2
Joined
Jul 5, 2005
Messages
125
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Detroit MI
Activity points
2,389
Hello, i am learning C++ and i try using escape sequences but they don't work since i am using windows XP. I tried modyfing Config.nt and adding

device=%SystemRoot%\system32\ansi.sys

to it, but it doesn't work!! even if i restart the comp. Any experts out there that know how to make escape sequences in C++ programs work on windows XP?
 

Can you post your code snippet? I don't the problem here. You are refering to a variable set in the environment and not in a C or C++ program.
 

Hows this :)

All "special characters" must be escaped!

Code:
#include <string>
#include <fstream>

using namespace std;

int main(int argc, char* argv[]) 
{
	string szFilename = "C:\\test.txt";
	string szBuffer = "device=%SystemRoot%\\system32\\ansi.sys\n\r";

	ofstream outfile( szFilename.c_str(), ofstream::binary );
	outfile.write( szBuffer.c_str(), szBuffer.length() );
	outfile.close();

  return 0;
}

Remmeber newlines are different for:
LF: Unix
CR+LF: Microsoft Windows
CR: Apple

In future post:
a) What you are trying to do.
b) Where you are stuck.
c) Any appropriate code snippets and information.

Hope that helps! :)
 

When i was reffering to escape sequences i meant Ascii escape sequences like the ones that clear the screen or the ones that move the cursor in dos window

for example when i try to use move cursor escape sequence in a macro

Code:
 # define MOVETO(z,s) (cout <<"\033[" << z << ';' << s << 'f')

i get output somethin like: 033[z;sf and the cursor doesn't move

my book says it is becaue windows XP isn't dos based, but there are ways to make them work
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top