-
Oct 20th, 2001, 05:33 PM
#1
Thread Starter
Fanatic Member
how can i use ascii in my c++ program?
i want to make a program that creates directories using the ascii number 255 on the desktop. to do this i need to know how to do the following. i need to do this using dos because windows doesnt understand the ascii number 255.
use the ascii number 255 in a md command.
change the directory the dos prompt is pointing too.
-
Oct 20th, 2001, 06:06 PM
#2
Monday Morning Lunatic
Under windows, use 160 for the same effect
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 20th, 2001, 06:14 PM
#3
Thread Starter
Fanatic Member
ye but how can i make do it using a c++ program. that way it would be automated.
-
Oct 22nd, 2001, 02:19 PM
#4
Thread Starter
Fanatic Member
i dont understand how thats different from just assignning a number to it?
-
Oct 22nd, 2001, 02:34 PM
#5
Thread Starter
Fanatic Member
and no it didnt work i got a error.
-
Oct 22nd, 2001, 07:24 PM
#6
Thread Starter
Fanatic Member
when i try this i get a error something about assertion. its supposed to make a directory using the ascii character number 255. also how can i change the directory that dos prompt is pointing to?
#include<iostream.h>
#include<conio.h>
#include<windows.h>
int main()
{
system("md haha" + (char)255); // The c_str() returns a const char*
return 0;
}
-
Oct 22nd, 2001, 07:33 PM
#7
transcendental analytic
Cstrings won't concentrate with + operator. You have to use strcat to concentrate Cstrings, or you can use a string class.
to get easy away, you can use the following trick with escape character:
system("md haha\255");
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 23rd, 2001, 07:22 AM
#8
alright, kedaman, that was what I was searching for, and that's why I used my weird solution
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 23rd, 2001, 02:43 PM
#9
Thread Starter
Fanatic Member
ye but i need it to be the ascii character number 255 ur exampe makes a directory called "haha-"
the ascii character 255 looks like a underscore in windows.
-
Oct 24th, 2001, 07:57 AM
#10
as parksie said, dos 255 == windows 160
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 24th, 2001, 02:13 PM
#11
Thread Starter
Fanatic Member
ye but isnt windows not supposed to be able to read that character so when u try to delete or open the folder it says it cant be found? how come when i do this:system("md haha99\160"); is creates a directory, but i can still open it.
-
Oct 25th, 2001, 08:48 AM
#12
what exactly does character 255 do? Isn't that the invisible trick character from dos? You were able to open those folders, but it was hard to identify thm.
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 25th, 2001, 12:32 PM
#13
Thread Starter
Fanatic Member
character 255 isnt understood by windows. if u go to dos prompt and make a directory using that character windows wont be able to identify it, open it, delete it, move it, etc.
-
Oct 27th, 2001, 04:22 PM
#14
Monday Morning Lunatic
It can, it's just interpreted as 160.
For example, create a folder with 255, then access it from windows using 160 - you get the same folder.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 27th, 2001, 04:40 PM
#15
This sounds kinda like a bug I found in IE...
I connected to my FTP (using IE) and tried to download something, and I got an error saying the file could not be found...
So I logged in to investigate and I found that there was a space at the beginning of the filename. Once I removed it, I could download it fine.
I guess IE trims spaces from the beginning of filenames. It is a UNIX server so its easy to put spaces at the beginning or end of filenames.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|