Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am sending a text file from server to client through net.socket.

At the client side I need to extract the data from the file.

I need the code to do so!

Kindly help.
:confused:
Posted
Updated 10-Nov-10 21:56pm
v2

Hi
Is this function what you're looking for maybee?

C#
/*--[ using directives ]---------------------------------------------------*/
using System.IO;

/*--[ Function ]-----------------------------------------------------------*/
/*
  Function Name   : ReadTxtFile_ToLst
  Description     : Reads data line- for line from a text file and stores
                    it to a list buffer.

  Access Modifier : public
  Param           : string txtFilePath

  Retval          : List<string>
*/
/*-------------------------------------------------------------------------*/
public List<string> ReadTxtFile_ToLst(string txtFilePath)
{
  List<string> returnValue = new List<string>();
  FileInfo genericFileInfo = new FileInfo(txtFilePath);
  StreamReader sr = genericFileInfo.OpenText();
  string lineContents;

  while (sr.EndOfStream != true)
  {
    lineContents = sr.ReadLine();
    returnValue.Add(lineContents);
  }

  sr.Close();

  return returnValue;
}


Regards ;-)
 
Share this answer
 
v4
What kind of data? How is it encoded in the 'text file'?
:)
 
Share this answer
 
Comments
kiddo_agile 9-Nov-10 14:12pm    
some binary numbers!!
10 01 etc
CPallini 9-Nov-10 15:20pm    
Have you troubles in parsing such numbers?
R. Erasmus 2-Dec-10 6:00am    
If you have questions rather add it as a comment.
CPallini 2-Dec-10 11:45am    
Whenever I have a question, I post it at the place I feel more appropriate.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900