Click here to Skip to main content
15,919,245 members
Home / Discussions / C#
   

C#

 
GeneralSmall IO help needed... Pin
eggie518-Oct-03 7:27
eggie518-Oct-03 7:27 
<code>public string[] twoCharArray;</code>
public buffer(string file)
{
    guid.button1.Enabled=false;

    FileInfo fi = new FileInfo(file);
    string rs = null;
    if (fi.Exists)
    {
        StreamReader sr = new StreamReader(file);
        while ((rs = sr.ReadLine()) != null)
        {
            stringFromFile += rs;
        }
        if (stringFromFile == null)
            MessageBox.Show("No text in bitfile.txt");
        else
        {
            <code>this.twoCharArray = stringFromFile.Split();</code>
        }
    }


Ok, check out that code. All it does is load a .txt file and then separate it into an array. The particular file it's processing is composed as follows...

81 09 0f f0 04 1a 0f f0 0f f0 09 0f f0 0f f0 0f f0 0f f0 09 0f f0 0f
f0 0f f0 0f f0 09 0f f0 0f f0 0f f0 0f f0 09 0f f0 0f f0 0f f0 0f f0 09 0f
f0 0f f0 0f f0 0f f0 09 0f f0 0f f0 0f f0 0f f0 09 0f f0 0f f0 0f f0 0f f0
09 0f f0 0f f0 0f f0 0f f0 09 0f f0 0f f0 0f f0 0f f0 ff 00 ff and so on...


So, it takes all of that and saves it into the string "stringFromFile". Then after it's all saved into the string it goes to...

this.twoCharArray = stringFromFile.Split();


Where it is spit up by at every space, so we get an array that "would look like this..."

"twoCharArray"
0| 81
1| 09
2| 0f
3| f0
4| 04
5| 1a
...


Now, here's what I need....

I need to add two things (00, ff) before every cell in the array. SO... the "twoCharArray", "will look like" this now... observe the pattern.

"twoCharArray"
00| 00
01| ff
02| 81
03| 00
04| ff
05| 09
06| 00
07| ff
08| 0f
09| 00
10| ff
11| f0
12| 00
13| ff
14| 04
15| 00
16| ff
17| 1a
...
...


I would believe this is quite simple, but yet again I cannot figure out how to do it...

Would someone please assist me with this roadblock?


/\ |_ E X E GG
GeneralRe: Small IO help needed... Pin
je_gonzalez18-Oct-03 10:16
je_gonzalez18-Oct-03 10:16 
GeneralRe: Small IO help needed... Pin
eggie518-Oct-03 17:56
eggie518-Oct-03 17:56 
GeneralRe: Small IO help needed... Pin
eggie518-Oct-03 11:47
eggie518-Oct-03 11:47 
GeneralRe: Small IO help needed... Pin
je_gonzalez18-Oct-03 12:44
je_gonzalez18-Oct-03 12:44 
GeneralRe: Small IO help needed... Pin
eggie518-Oct-03 14:39
eggie518-Oct-03 14:39 
GeneralRe: Small IO help needed... Pin
je_gonzalez18-Oct-03 15:27
je_gonzalez18-Oct-03 15:27 
GeneralRe: Small IO help needed... Pin
eggie518-Oct-03 17:07
eggie518-Oct-03 17:07 
Generalopen external application Pin
JockerSoft18-Oct-03 6:50
JockerSoft18-Oct-03 6:50 
GeneralRe: open external application Pin
eggie518-Oct-03 6:57
eggie518-Oct-03 6:57 
GeneralRe: open external application Pin
Heath Stewart18-Oct-03 16:12
protectorHeath Stewart18-Oct-03 16:12 
GeneralRe: open external application Pin
JockerSoft18-Oct-03 23:43
JockerSoft18-Oct-03 23:43 
GeneralRe: open external application Pin
Heath Stewart19-Oct-03 5:36
protectorHeath Stewart19-Oct-03 5:36 
GeneralSame control for windows and web Pin
Inam18-Oct-03 6:37
Inam18-Oct-03 6:37 
GeneralRe: Same control for windows and web Pin
fadee18-Oct-03 9:12
fadee18-Oct-03 9:12 
GeneralRe: Same control for windows and web Pin
Heath Stewart18-Oct-03 10:27
protectorHeath Stewart18-Oct-03 10:27 
GeneralRe: Same control for windows and web Pin
fadee18-Oct-03 21:01
fadee18-Oct-03 21:01 
GeneralQuestion about Windows Forms.. Pin
hammackj17-Oct-03 21:17
hammackj17-Oct-03 21:17 
GeneralRe: Question about Windows Forms.. Pin
Kannan Kalyanaraman18-Oct-03 1:10
Kannan Kalyanaraman18-Oct-03 1:10 
GeneralRe: Question about Windows Forms.. Pin
Heath Stewart18-Oct-03 10:33
protectorHeath Stewart18-Oct-03 10:33 
GeneralRe: Question about Windows Forms.. Pin
hammackj18-Oct-03 12:52
hammackj18-Oct-03 12:52 
GeneralRe: Question about Windows Forms.. Pin
Heath Stewart18-Oct-03 16:08
protectorHeath Stewart18-Oct-03 16:08 
GeneralRe: Question about Windows Forms.. Pin
Judah Gabriel Himango18-Oct-03 23:23
sponsorJudah Gabriel Himango18-Oct-03 23:23 
GeneralTextbox question Pin
mweiss17-Oct-03 19:26
mweiss17-Oct-03 19:26 
QuestionMP3 Player in C# ??? Pin
Dato17-Oct-03 14:50
Dato17-Oct-03 14:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.