Initializing help system before first use

XPRBreadline Method

Read a formatted line from a data file. Anything after a comment (! denotes the beginning of a comment) will be ignored. This will read multiple lines if the line ends with &.

Namespace:   BCL
Assembly:  xprbdn (in xprbdn.dll) Version: 4.8.14.0
Syntax
C#
VB
public int XPRBreadline(
	StreamReader fileStreamIn,
	int maxlen,
	string format,
	out Object[] output
)

Parameters

fileStreamIn
Type:  System.IOStreamReader
The open StreamReader to read the data from.
maxlen
Type:  SystemInt32
The maximum length of data to read.
format
Type:  SystemString
The format to read the data in. This is a string made up of the following formats, seperated by any seperating characters. The format must be exact with respect to spacing (if there are 0+ spaces between the entries then a space " " must be included in the format string). See the BCL example programs for examples of this.
  • {g} - A double value.
  • {i} - An integer value.
  • {t} or {T} - A string value.
  • {s} - A string within single quotes.
  • {S} - A string within double quotes.
output
Type:  SystemObject
The out object array. The results from this must be unboxed to the correct type on return and allocated to the relevant variables. See the BCL examples for examples of this.

Return Value

Type:  Int32
The integer number of items read, -1 on error.
Examples
XPRBprob prob = new XPRBprob("NewProb"); file = new FileStream("TestFileRead.txt", FileMode.Open, FileAccess.Read); fileStreamIn = new StreamReader(file); outobj = new object[3]; prob.XPRBreadline(fileStreamIn, 200, "{i}, {g}, {S}", out outobj); fileStreamIn.Close(); file.Close();
See Also