file reading. The trouble is, there is no such thing as a StringType
variable. The getline function seems to require a pointer to a variable of
type char to work. So exactly how am I supposed to get this to work, and
explaination about a very basic subject, but it would really be a great help.
If you use MFC you can use CStdioFile and just use ReadString() to read as
many lines as you want or Read() in general to read up to the whole file
depending on how much you want to read. If you are not using MFC you could
use any number of other C++/C IO functions.
The typical ASCII table is broken into 4 segments of 32. The first 32 0-31
are control characters (some are unreadable, but in fonts some have
characters assigned to them). These are left over from the old teletype
days and each had special meaning. We still use some of them today (like
backspace, tab, cr, and nl). The second 32 32-63 are punctuation, numbers,
and symbols, the third upper case letters, and the 4th lower case letters.
They sandwiched in a few more symbols in the 3rd and 4th segments because we
only have 26 characters. If you want to fill an array with them I would
just make a char array of 127 and fill it in with a simple loop:
char ASCII[127];
for(i=0; i < 127; ++i)
ASCII[i] = i;
Tom
"Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message
news:7AA87FC0-3D4A-41D3-A311-69577443B781@microsoft.com...
So, programmatically, what would the code be for this? What functions
would
I use, and how would I modify them to do what you're describing?
As for the ASCII table, are you saying I should just phystically write
every
value in the ASCII table into the vector? There's no automatic way to
look
through and copy it?
I'm sorry about requesting specific code, but I don't have much experience
with this type of thing, and I do a lot better if I have concrete, working
examples to work off of. I don't need anything fancy, just a couple
functions that do what I need and descriptions of that parameters they
expect, now to pass them correctly, etc.
Thanks!
Dustin
"Tom Serface" wrote:
One way to do this, in a text file, is to read one or more lines at a
time
then use the lines as a buffer. You can read a lot into memory and it's
much faster to work with the data once it's read in.
To create an ASCII table is pretty simple. This link might help you out:
http://en.wikipedia.org/wiki/ASCII
Tom
"Dustin Ventin" <DustinVentin@discussions.microsoft.com> wrote in message
news:10481424-2D2B-4401-AED9-F4D6500D2F37@microsoft.com...
I actually have two questions.
The first involves reading from a normal everyday txt file. I need to
be
able to read data from a text file a variable number of characters at a
time.
I may need to read in one character at one point, or three, or five.
Is
there a function that allows me to say: "read in x characters from
where
the
pointer is now in the file"? What about moving the pointer in the file
back
a couple characters? For example, from:
This is a sample sentence.
^Pointer
Move back three characters to:
This is a sample sentence.
^Pointer
Information on these fuctions and how to use them would be invaluable.
PLEASE keep in mind that it is imperitive that whitespaces, carrage
returns,
etc must ALL be included in the data returned be these functions, so
that
I
can save this data and print it out again, returning EXACTLY the same
file
as
was input.
Second question:
I need to place the entire ASCII character library into a vector. For
example, if the ASCII character library goes 'a', 'A','b','B','c','C',
my
vector will read:
MyVector[0] = 'a';
MyVector[1] = 'A';
MyVector[2] = 'b';
MyVector[3] = 'B';
MyVector[4] = 'c';
MyVector[5] = 'C';
I want to programatically write the entire library into a vector. I
imagine
that this is fairly simple with a for loop and the appropriate call to
the
ASCII libraby. Any ideas?
This is a very time-sensitive project I am working on, so the sooner I
get
an answer the better. Thank you so much!
Dustin