get(char*, num, delim) question | | |
Hello,
I've got a program that is reading in a data file of 25 lines. Here is
an example of the first two lines:
sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0
In my program, I need to read in each line, BUT, I need to build a
different object based upon the characters in the first field. So, I
need to GET the first characters. And here's where I'm doing something
incorrectly. This is what I've got so far:
char readInFirstChars(ifstream &fin) {
char *first;
fin.get(first, 3, '/');
cout << first; // debugging line to see what is output
}
return first;
}
The above code give me a compile error stating:
" invalid conversion from `char*' to `char'"
I tried the get function with the single character parameter like such:
char first;
fin.get(first);
cout << first << endl;
return first;
and it works fine. So I must be doing something wrong with the pointer.
The other tangent problem I'm having with this how to properly cycle
through the input file so it only reads in the first field and then
moves on to the next line. I tried
while (fin.good()) {
char first;
fin.get(first);
cout << first << endl;
}
return first;
Which looped, but it output the entire file. I only need the first
field. If the first field were only one character, then the only
problem I would be dealing with is the loop problem, but since it's
either 1 or 2 characters (with the end delimeter being '/'), I'm also
dealing with the get() problem.
Thanks for any advice.
Frank | | | | re: get(char*, num, delim) question
"Francis Bell" <phrankndonna@charter.net> wrote in message
news:10av1bf4i5k4h36@corp.supernews.com...[color=blue]
> Hello,
>
> I've got a program that is reading in a data file of 25 lines. Here is
> an example of the first two lines:
>
> sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
> f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0
>
> In my program, I need to read in each line, BUT, I need to build a
> different object based upon the characters in the first field. So, I
> need to GET the first characters. And here's where I'm doing something
> incorrectly. This is what I've got so far:
>
> char readInFirstChars(ifstream &fin) {
> char *first;
> fin.get(first, 3, '/');
> cout << first; // debugging line to see what is output
> }
> return first;
> }
>
> The above code give me a compile error stating:
> " invalid conversion from `char*' to `char'"
>
> I tried the get function with the single character parameter like such:
> char first;
> fin.get(first);
> cout << first << endl;
> return first;
>
> and it works fine. So I must be doing something wrong with the pointer.[/color]
Yes, two different things actually. And of course you should be using a
pointer at all. Try this
char first[3];
fin.getline(first, 3, '/');
Important lesson is to understand the difference between
char *first;
and
char first[3];
The first declares a pointer to char, it does not create any characters at
all. Just declaring a pointer does not make it point at anything. So in your
code you do not have any characters to read the first field into. Even if
you had got it to compile it would have crashed when you tried to do the
read.
The second declares an array of three characters, these are the three
characters you are going to read your field into. No need for compilcated
pointers, just use an array.
Your second mistake was to use get instead of getline.
john | | | | re: get(char*, num, delim) question
John Harrison wrote:[color=blue]
> "Francis Bell" <phrankndonna@charter.net> wrote in message
> news:10av1bf4i5k4h36@corp.supernews.com...
>[color=green]
>>Hello,
>>
>>I've got a program that is reading in a data file of 25 lines. Here is
>>an example of the first two lines:
>>
>>sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
>>f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0
>>
>>In my program, I need to read in each line, BUT, I need to build a
>>different object based upon the characters in the first field. So, I
>>need to GET the first characters. And here's where I'm doing something
>>incorrectly. This is what I've got so far:
>>
>>char readInFirstChars(ifstream &fin) {
>>char *first;
>> fin.get(first, 3, '/');
>> cout << first; // debugging line to see what is output
>>}
>>return first;
>>}
>>
>>The above code give me a compile error stating:
>>" invalid conversion from `char*' to `char'"
>>
>>I tried the get function with the single character parameter like such:
>> char first;
>> fin.get(first);
>> cout << first << endl;
>> return first;
>>
>>and it works fine. So I must be doing something wrong with the pointer.[/color]
>
>
> Yes, two different things actually. And of course you should be using a
> pointer at all. Try this
>
> char first[3];
> fin.getline(first, 3, '/');
>
> Important lesson is to understand the difference between
>
> char *first;
>
> and
>
> char first[3];
>
> The first declares a pointer to char, it does not create any characters at
> all. Just declaring a pointer does not make it point at anything. So in your
> code you do not have any characters to read the first field into. Even if
> you had got it to compile it would have crashed when you tried to do the
> read.
>
> The second declares an array of three characters, these are the three
> characters you are going to read your field into. No need for compilcated
> pointers, just use an array.
>
> Your second mistake was to use get instead of getline.
>
> john
>
>[/color]
Hi John,
First, thanks for the quick reply! Unfortunately, I have been
instructed to use the get() function vice the getline() function. From
what I understand about the get() function with the three parameters, it
reads characters into a buffer until num - 1 characters have been read,
or in my case, until the '/' delim character is encountered. This way,
if it reads a line where the first field is only one character, it reads
that character and then encounters the '/' delimeter and stops. But
it's the first parameter that I'm not doing correctly. ... However,
what you said about me having just declared a pointer and not pointing
to anything made me think of something. And I just tried something else
and it worked for both of my problems! This is what I did:
while (fin.good())
{
fin.get(first, 4, '/');
cout << first << endl;
fin.ignore(80, '\n');
}
delete [] first;
This displays 'sp' to the screen for that first line of text in the data
file and 'f' for the second line, and the first field for all of the
other lines until EOF.
So now I'm on to the next problem in my program. But I'll work on that
for a few hours before posting back if I need to. Thanks again John for
looking at this. Although I couldn't use the getline as you suggested,
your suggestion pointed me to my problem. Thanks!
Frank | | | | re: get(char*, num, delim) question
"Francis Bell" <phrankndonna@charter.net> wrote in message
news:10av5e19bu49gb5@corp.supernews.com...[color=blue]
> John Harrison wrote:[color=green]
> > "Francis Bell" <phrankndonna@charter.net> wrote in message
> > news:10av1bf4i5k4h36@corp.supernews.com...
> >[color=darkred]
> >>Hello,
> >>
> >>I've got a program that is reading in a data file of 25 lines. Here is
> >>an example of the first two lines:
> >>
> >>sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
> >>f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0
> >>
> >>In my program, I need to read in each line, BUT, I need to build a
> >>different object based upon the characters in the first field. So, I
> >>need to GET the first characters. And here's where I'm doing something
> >>incorrectly. This is what I've got so far:
> >>
> >>char readInFirstChars(ifstream &fin) {
> >>char *first;
> >> fin.get(first, 3, '/');
> >> cout << first; // debugging line to see what is output
> >>}
> >>return first;
> >>}
> >>
> >>The above code give me a compile error stating:
> >>" invalid conversion from `char*' to `char'"
> >>
> >>I tried the get function with the single character parameter like such:
> >> char first;
> >> fin.get(first);
> >> cout << first << endl;
> >> return first;
> >>
> >>and it works fine. So I must be doing something wrong with the pointer.[/color]
> >
> >
> > Yes, two different things actually. And of course you should be using a
> > pointer at all. Try this
> >
> > char first[3];
> > fin.getline(first, 3, '/');
> >
> > Important lesson is to understand the difference between
> >
> > char *first;
> >
> > and
> >
> > char first[3];
> >
> > The first declares a pointer to char, it does not create any characters[/color][/color]
at[color=blue][color=green]
> > all. Just declaring a pointer does not make it point at anything. So in[/color][/color]
your[color=blue][color=green]
> > code you do not have any characters to read the first field into. Even[/color][/color]
if[color=blue][color=green]
> > you had got it to compile it would have crashed when you tried to do the
> > read.
> >
> > The second declares an array of three characters, these are the three
> > characters you are going to read your field into. No need for[/color][/color]
compilcated[color=blue][color=green]
> > pointers, just use an array.
> >
> > Your second mistake was to use get instead of getline.
> >
> > john
> >
> >[/color]
> Hi John,
> First, thanks for the quick reply! Unfortunately, I have been
> instructed to use the get() function vice the getline() function.[/color]
Any particular reason?
[color=blue]
> From
> what I understand about the get() function with the three parameters, it
> reads characters into a buffer until num - 1 characters have been read,
> or in my case, until the '/' delim character is encountered.[/color]
Yes, I'd forgotten about that, which is why I recommended getline,.but get
works too. The difference between get and getline, is that getline reads the
delimiter whereas get doesn't.
[color=blue]
> This way,
> if it reads a line where the first field is only one character, it reads
> that character and then encounters the '/' delimeter and stops. But
> it's the first parameter that I'm not doing correctly. ... However,
> what you said about me having just declared a pointer and not pointing
> to anything made me think of something. And I just tried something else
> and it worked for both of my problems! This is what I did:
>[/color]
I guess you missed out
char* first = new char[4];
or something similar.
[color=blue]
> while (fin.good())
> {
> fin.get(first, 4, '/');
> cout << first << endl;
> fin.ignore(80, '\n');
> }
> delete [] first;[/color]
Its still preferable to use an array instead of a pointer. Its more
efficient, safer and simpler, what's not to like?
Also you loop is wrong. The file might still be good even when you are at
the end of the file so you end up going round the loop one too many times.
Your loop should look like this
while (fin.get(first, 4, '/'))
{
cout << first << endl;
fin.ignore(80, '\n');
}
john | | | | re: get(char*, num, delim) question
On Sat, 22 May 2004 22:54:45 +0100, "John Harrison"
<john_andronicus@hotmail.com> wrote:
[color=blue]
>
>"Francis Bell" <phrankndonna@charter.net> wrote in message
>news:10av5e19bu49gb5@corp.supernews.com...[color=green]
>> John Harrison wrote:[color=darkred]
>> > "Francis Bell" <phrankndonna@charter.net> wrote in message
>> > news:10av1bf4i5k4h36@corp.supernews.com...
>> >
>> >>Hello,
>> >>
>> >>I've got a program that is reading in a data file of 25 lines. Here is
>> >>an example of the first two lines:
>> >>
>> >>sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
>> >>f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0
>> >>
>> >>In my program, I need to read in each line, BUT, I need to build a
>> >>different object based upon the characters in the first field. So, I
>> >>need to GET the first characters. And here's where I'm doing something
>> >>incorrectly. This is what I've got so far:
>> >>
>> >>char readInFirstChars(ifstream &fin) {
>> >>char *first;
>> >> fin.get(first, 3, '/');
>> >> cout << first; // debugging line to see what is output
>> >>}
>> >>return first;
>> >>}
>> >>
>> >>The above code give me a compile error stating:
>> >>" invalid conversion from `char*' to `char'"
>> >>
>> >>I tried the get function with the single character parameter like such:
>> >> char first;
>> >> fin.get(first);
>> >> cout << first << endl;
>> >> return first;
>> >>
>> >>and it works fine. So I must be doing something wrong with the pointer.
>> >
>> >
>> > Yes, two different things actually. And of course you should be using a
>> > pointer at all. Try this
>> >
>> > char first[3];
>> > fin.getline(first, 3, '/');
>> >
>> > Important lesson is to understand the difference between
>> >
>> > char *first;
>> >
>> > and
>> >
>> > char first[3];
>> >
>> > The first declares a pointer to char, it does not create any characters[/color][/color]
>at[color=green][color=darkred]
>> > all. Just declaring a pointer does not make it point at anything. So in[/color][/color]
>your[color=green][color=darkred]
>> > code you do not have any characters to read the first field into. Even[/color][/color]
>if[color=green][color=darkred]
>> > you had got it to compile it would have crashed when you tried to do the
>> > read.
>> >
>> > The second declares an array of three characters, these are the three
>> > characters you are going to read your field into. No need for[/color][/color]
>compilcated[color=green][color=darkred]
>> > pointers, just use an array.
>> >
>> > Your second mistake was to use get instead of getline.
>> >
>> > john
>> >
>> >[/color]
>> Hi John,
>> First, thanks for the quick reply! Unfortunately, I have been
>> instructed to use the get() function vice the getline() function.[/color]
>
>Any particular reason?
>[color=green]
>> From
>> what I understand about the get() function with the three parameters, it
>> reads characters into a buffer until num - 1 characters have been read,
>> or in my case, until the '/' delim character is encountered.[/color]
>
>Yes, I'd forgotten about that, which is why I recommended getline,.but get
>works too. The difference between get and getline, is that getline reads the
>delimiter whereas get doesn't.
>[color=green]
>> This way,
>> if it reads a line where the first field is only one character, it reads
>> that character and then encounters the '/' delimeter and stops. But
>> it's the first parameter that I'm not doing correctly. ... However,
>> what you said about me having just declared a pointer and not pointing
>> to anything made me think of something. And I just tried something else
>> and it worked for both of my problems! This is what I did:
>>[/color]
>
>I guess you missed out
>
>char* first = new char[4];
>
>or something similar.
>[color=green]
>> while (fin.good())
>> {
>> fin.get(first, 4, '/');
>> cout << first << endl;
>> fin.ignore(80, '\n');
>> }
>> delete [] first;[/color]
>
>Its still preferable to use an array instead of a pointer. Its more
>efficient, safer and simpler, what's not to like?
>
>Also you loop is wrong. The file might still be good even when you are at
>the end of the file so you end up going round the loop one too many times.
>Your loop should look like this
>
>while (fin.get(first, 4, '/'))
>{
> cout << first << endl;
> fin.ignore(80, '\n');
>}
>
>john
>[/color]
Yeah, sorry, I forgot to copy and paste the pointer declaration. What
you put is accurate. This project is for a class, and my lab
instructor said we needed to use get() because we need the practice
with it. Although an array may be safer and simpler, this form of
get() that I needed to use doesn't allow for an array in the
parameters, otherwise I would have used it (primarily because I'm just
now getting used to pointers and I know that I know just enough about
them to be dangerous: :) ) I'll use the loop enhancement. Thanks
again John!!
Frank | | | | re: get(char*, num, delim) question
Francis Bell <phrankndonna@charter.net> wrote in message
[color=blue][color=green][color=darkred]
> >>sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
> >>f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0[/color][/color][/color]
[color=blue][color=green]
> > char first[3];
> > fin.getline(first, 3, '/');[/color][/color]
[color=blue]
> while (fin.good())
> {
> fin.get(first, 4, '/');
> cout << first << endl;
> fin.ignore(80, '\n');
> }
> delete [] first;[/color]
How did you declare first? If as char first[4] then the call to
delete is unnecessary, and will, in some systems, cause a program
crash. | | | | re: get(char*, num, delim) question
Siemel Naran wrote:[color=blue]
> Francis Bell <phrankndonna@charter.net> wrote in message
>
>[color=green][color=darkred]
>>>>sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
>>>>f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0[/color][/color]
>
>[color=green][color=darkred]
>>>char first[3];
>>>fin.getline(first, 3, '/');[/color][/color]
>
>[color=green]
>> while (fin.good())
>> {
>> fin.get(first, 4, '/');
>> cout << first << endl;
>> fin.ignore(80, '\n');
>> }
>> delete [] first;[/color]
>
>
> How did you declare first? If as char first[4] then the call to
> delete is unnecessary, and will, in some systems, cause a program
> crash.[/color]
Hi all,
I declared first like this:
void readInFirstChars(ifstream &fin)
{
char* first;
first = new char[2];
while (fin.good())
{
fin.get(first, 4, '/');
cout << first << endl;
fin.ignore(80, '\n');
}
cout << "Here first" << endl;
if (first == "sp") {
cout << "Here second" << endl;
Spinnerbait temp;
readInASpinnerbait(fin);
temp.outputSpinnerbait(cout);
}
delete [] first;
I included my whole function because I spoke too soon earlier when I
said everything worked. My function is not getting inside the 'if'
clause. I know this because "Here first" is printing out to the screen,
but "Here second" is not. I'm pretty sure it's because of my condition
(first == "sp"). I know first is a pointer to my character array that
gets my first field from the data file, so comparing it with "sp" is
probably, no IS incorrect. But I tried dereferencing first and
comparing, and I got a compile error stating, "ISO C++ forbids
comparison between pointer and integer". So, that said, how do I go
about comparing these? | | | | re: get(char*, num, delim) question
>[color=blue]
> Yeah, sorry, I forgot to copy and paste the pointer declaration. What
> you put is accurate. This project is for a class, and my lab
> instructor said we needed to use get() because we need the practice
> with it. Although an array may be safer and simpler, this form of
> get() that I needed to use doesn't allow for an array in the
> parameters,[/color]
That is not true, an array and a pointer are equivalent in this situation
(as they are in most situations).
john | | | | re: get(char*, num, delim) question
> Hi all,[color=blue]
>
> I declared first like this:
>
> void readInFirstChars(ifstream &fin)
> {
> char* first;
> first = new char[2];[/color]
first = new char[4];
but as I said earlier you should be using an array
char first[4];
In either case though you need four characters, if you are going to say
fin.get(first, 4, '/');
[color=blue]
> while (fin.good())
> {
> fin.get(first, 4, '/');
> cout << first << endl;
> fin.ignore(80, '\n');
> }
> cout << "Here first" << endl;
> if (first == "sp") {[/color]
This is wrong, you do not compare strings with ==
if (strcmp(first, "sp") == 0)
[color=blue]
> cout << "Here second" << endl;
> Spinnerbait temp;
> readInASpinnerbait(fin);
> temp.outputSpinnerbait(cout);
> }
> delete [] first;[/color]
Get rid of this if you switch to an array.
[color=blue]
>
> I included my whole function because I spoke too soon earlier when I
> said everything worked. My function is not getting inside the 'if'
> clause. I know this because "Here first" is printing out to the screen,
> but "Here second" is not. I'm pretty sure it's because of my condition
> (first == "sp"). I know first is a pointer to my character array that
> gets my first field from the data file, so comparing it with "sp" is
> probably, no IS incorrect.[/color]
No, first == "sp" is a pointer comparison, it compares where first is
pointing to with where "sp" is. You need strcmp to copare the strings
themeselves.
[color=blue]
> But I tried dereferencing first and
> comparing, and I got a compile error stating, "ISO C++ forbids
> comparison between pointer and integer". So, that said, how do I go
> about comparing these?
>[/color]
Seems like you are learning an old fashioned style of C++ programming.
Modern C++ has a string class which is easier to use than a char array (or
char pointer).
john | | | | re: get(char*, num, delim) question
Francis Bell <phrankndonna@charter.net> wrote in message
[color=blue]
> sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
> f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0[/color]
[color=blue]
> void readInFirstChars(ifstream &fin)
> {
> char* first;
> first = new char[2];[/color]
It's fine to just say
char first[2];
and remove the delete statement below.
[color=blue]
> while (fin.good())
> {
> fin.get(first, 4, '/');[/color]
Why is first of 2 chars but you read 4 chars into it?
[color=blue]
> cout << first << endl;
> fin.ignore(80, '\n');
> }
> cout << "Here first" << endl;
> if (first == "sp") {[/color]
You're comparing the value of the pointers (ie. comparing the memory
address locations). Use std::strcmp from <cstring> (same as strcmp
from string.h).
[color=blue]
> cout << "Here second" << endl;
> Spinnerbait temp;
> readInASpinnerbait(fin);
> temp.outputSpinnerbait(cout);
> }
> delete [] first;[/color] | | | | re: get(char*, num, delim) question
On 22 May 2004 23:56:12 -0700, namespace@excite.com (Siemel Naran)
wrote:
[color=blue]
>Francis Bell <phrankndonna@charter.net> wrote in message
>[color=green]
>> sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
>> f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0[/color]
>[color=green]
>> void readInFirstChars(ifstream &fin)
>> {
>> char* first;
>> first = new char[2];[/color]
>
>It's fine to just say
> char first[2];
>and remove the delete statement below.
>[color=green]
>> while (fin.good())
>> {
>> fin.get(first, 4, '/');[/color]
>
>Why is first of 2 chars but you read 4 chars into it?
>[color=green]
>> cout << first << endl;
>> fin.ignore(80, '\n');
>> }
>> cout << "Here first" << endl;
>> if (first == "sp") {[/color]
>
>You're comparing the value of the pointers (ie. comparing the memory
>address locations). Use std::strcmp from <cstring> (same as strcmp
>from string.h).
>[color=green]
>> cout << "Here second" << endl;
>> Spinnerbait temp;
>> readInASpinnerbait(fin);
>> temp.outputSpinnerbait(cout);
>> }
>> delete [] first;[/color][/color]
Thanks John and Siemel. I'll go back in and try changing it to an
array. However, the documentation for the parameters for that form of
get() function show that the first parameter needs to be a char*, but
I'll try the array. Also, the documentation says that for the second
parameter (num), it reads up to num-1 characters of the input stream,
or until the delimeter (third parameter) is reached or EOF is reached.
So, I have at most a two character first field with a third character
being the '/' delimeter for a total of 3 characters for the function
to read. So I simply figured it needed num - 1 and I needed 3 so
that's where I came up with 4. And I've used the strcmp before, but
completely forgot about it. Thanks! I'll get back with you and let
you know how things work out.
Frank | | | | re: get(char*, num, delim) question
> Thanks John and Siemel. I'll go back in and try changing it to an[color=blue]
> array. However, the documentation for the parameters for that form of
> get() function show that the first parameter needs to be a char*, but
> I'll try the array.[/color]
Yes, array are autoamtically converted to pointers, so any function which
say it needs a pointer can be given an array.
Also, the documentation says that for the second[color=blue]
> parameter (num), it reads up to num-1 characters of the input stream,
> or until the delimeter (third parameter) is reached or EOF is reached.
> So, I have at most a two character first field with a third character
> being the '/' delimeter for a total of 3 characters for the function
> to read. So I simply figured it needed num - 1 and I needed 3 so
> that's where I came up with 4.[/color]
4 is fine, but the size of the array and the size you pass to get must be
the same. You are telling get that you have four characters in the array,
but actually you've only got two.
john | | | | re: get(char*, num, delim) question
Phrank wrote:[color=blue]
> On 22 May 2004 23:56:12 -0700, namespace@excite.com (Siemel Naran)
> wrote:
>
>[color=green]
>>Francis Bell <phrankndonna@charter.net> wrote in message
>>
>>[color=darkred]
>>>sp/spinnerbait/AAA Lures/Mad Phil/silver/bass/1/1
>>>f/floating minnow/AAA Lures/Skinny Minney/green/bass/0/0/0[/color]
>>[color=darkred]
>>>void readInFirstChars(ifstream &fin)
>>>{
>>> char* first;
>>> first = new char[2];[/color]
>>
>>It's fine to just say
>> char first[2];
>>and remove the delete statement below.
>>
>>[color=darkred]
>>> while (fin.good())
>>> {
>>> fin.get(first, 4, '/');[/color]
>>
>>Why is first of 2 chars but you read 4 chars into it?
>>
>>[color=darkred]
>>> cout << first << endl;
>>> fin.ignore(80, '\n');
>>> }
>>>cout << "Here first" << endl;
>>> if (first == "sp") {[/color]
>>
>>You're comparing the value of the pointers (ie. comparing the memory
>>address locations). Use std::strcmp from <cstring> (same as strcmp[/color]
>[color=green]
>>from string.h).[/color]
>[color=green][color=darkred]
>>>cout << "Here second" << endl;
>>> Spinnerbait temp;
>>> readInASpinnerbait(fin);
>>> temp.outputSpinnerbait(cout);
>>> }
>>> delete [] first;[/color][/color]
>
> Thanks John and Siemel. I'll go back in and try changing it to an
> array. However, the documentation for the parameters for that form of
> get() function show that the first parameter needs to be a char*, but
> I'll try the array. Also, the documentation says that for the second
> parameter (num), it reads up to num-1 characters of the input stream,
> or until the delimeter (third parameter) is reached or EOF is reached.
> So, I have at most a two character first field with a third character
> being the '/' delimeter for a total of 3 characters for the function
> to read. So I simply figured it needed num - 1 and I needed 3 so
> that's where I came up with 4. And I've used the strcmp before, but
> completely forgot about it. Thanks! I'll get back with you and let
> you know how things work out.
>
> Frank[/color]
Hi all,
I changed things around and am now using the array version. Everything
for this part of the problem is working fine now. I still have other
issues with the program, but it's one step at a time, and I want to look
at it further myself and try to figure it out before posting here.
Thanks again!
Frank |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,327 network members.
|