PC Review


Reply
Thread Tools Rate Thread

c++ StreamReader Substring visual studio.net

 
 
collinse@gmail.com
Guest
Posts: n/a
 
      21st Mar 2005
**** PLEASE HELP ME ************************************
***** SEE BELOW*****************************************
StreamReader* sr = File::OpenText(path);
try {
String *s = "";

int place = 0; // looks for the ID FIELD
String *ID_val = "IAO_"; // ID is the leader if the id
String *ID;
String *temp;
while (s = sr->ReadLine()){
place = s->IndexOf(ID_val);
if ( place == 1)
{
Console::WriteLine(s->Substring(1,8)); //this works
temp = s->Substring(1,8); // this is my problem
}}
// i just want to save the substring as a string.

 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      21st Mar 2005
So what is the problem?

Also, you realize that IndexOf returns the zero based index, so unless
you expect the place to be at the second character, you might want to
compare it against zero.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> **** PLEASE HELP ME ************************************
> ***** SEE BELOW*****************************************
> StreamReader* sr = File::OpenText(path);
> try {
> String *s = "";
>
> int place = 0; // looks for the ID FIELD
> String *ID_val = "IAO_"; // ID is the leader if the id
> String *ID;
> String *temp;
> while (s = sr->ReadLine()){
> place = s->IndexOf(ID_val);
> if ( place == 1)
> {
> Console::WriteLine(s->Substring(1,8)); //this works
> temp = s->Substring(1,8); // this is my problem
> }}
> // i just want to save the substring as a string.
>



 
Reply With Quote
 
collinse@gmail.com
Guest
Posts: n/a
 
      22nd Mar 2005
temp = s->Substring(1,8); // this is my problem
this line will not work however the line before this one works fine.
why will substring not work with stringreader? please help me..........

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enabling browser back button for GridView Paging and Sorting in Ajax1.1 and 3.5 (using Visual Studio 2005/ Visual studio 2008) anil reddy Microsoft C# .NET 0 11th Feb 2009 04:22 PM
Enabling browser back button for GridView Paging and Sorting in Ajax1.1 and 3.5 (using Visual Studio 2005/ Visual studio 2008) anil reddy Microsoft ASP .NET 0 11th Feb 2009 04:22 PM
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft Dot NET 4 17th May 2007 07:56 PM
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft Dot NET Framework 1 14th May 2007 08:05 PM
How to take an IE rendered screenshot of a website with visual studio .net 2002 or visual stuido .net 2003? I can't install visual studio .net 2005 on this computer. Daniel Microsoft C# .NET 0 14th May 2007 07:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:31 PM.