Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
GeneralRe: single log file for two classes. Pin
Garth J Lancaster11-Jan-13 12:56
professionalGarth J Lancaster11-Jan-13 12:56 
GeneralRe: single log file for two classes. Pin
vanikanc14-Jan-13 3:00
vanikanc14-Jan-13 3:00 
AnswerRe: single log file for two classes. Pin
PIEBALDconsult11-Jan-13 13:26
mvePIEBALDconsult11-Jan-13 13:26 
GeneralRe: single log file for two classes. Pin
vanikanc15-Jan-13 2:24
vanikanc15-Jan-13 2:24 
GeneralRe: single log file for two classes. Pin
PIEBALDconsult15-Jan-13 3:08
mvePIEBALDconsult15-Jan-13 3:08 
QuestionBinary File Library Pin
dxtrx11-Jan-13 10:24
dxtrx11-Jan-13 10:24 
AnswerRe: Binary File Library Pin
Garth J Lancaster11-Jan-13 11:18
professionalGarth J Lancaster11-Jan-13 11:18 
GeneralRe: Binary File Library Pin
dxtrx11-Jan-13 11:41
dxtrx11-Jan-13 11:41 
C#
bwBooks.Write(FillBlanks(bookTittle, 30));
bwBooks.Write(FillBlanks(bookTittle,25));
bwBooks.Write(FillBlanks(pubCompany, 15));


the book tittle is a mistake i have made

this the code I use to read the Books
<pre lang="c#">public static void ReadBooks()
        {
            bool found = false;
            Console.WriteLine("Write the number u are looking for");
            int wantedNR = Int32.Parse(Console.ReadLine());

            FileStream file = new FileStream("Books.bin", FileMode.Open, FileAccess.Read);
            BinaryReader binReader = new BinaryReader(file);

            while (file.Position!=file.Length)
            {
                int bookNumber = binReader.ReadInt32();
                if (bookNumber==wantedNR)
                {
                    found=true;
                    string bookName = binReader.ReadString();
                    string authorName = binReader.ReadString();
                    string pubCompany = binReader.ReadString();
                    Console.WriteLine("============================================");
                    Console.WriteLine("Book Number:" + bookNumber);
                    Console.WriteLine("Book Name:" + bookName);
                    Console.WriteLine("Author:" + authorName);
                    Console.WriteLine("Publishing Company:" + pubCompany);
                    Console.WriteLine("===========================================");
                    break;
                }
                else
                {
                    binReader.BaseStream.Seek(73, SeekOrigin.Current);
                }
            }

            binReader.Close();
            file.Close();
            if (found == false)
            {
                Console.WriteLine("The Wanted Number u are looking for{0} doesn't exist in this file", wantedNR);
            }
            
        }

if u can help me and tell me how to use this Dictionary thing u posted(since this is the first time I see it) it would help me lot since I really don't know how to do this
GeneralRe: Binary File Library Pin
Garth J Lancaster11-Jan-13 12:43
professionalGarth J Lancaster11-Jan-13 12:43 
GeneralRe: Binary File Library Pin
dxtrx11-Jan-13 12:47
dxtrx11-Jan-13 12:47 
QuestionLatency In Button Click When Using MVVM Pin
Tee12311-Jan-13 7:25
Tee12311-Jan-13 7:25 
AnswerRe: Latency In Button Click When Using MVVM Pin
SledgeHammer0111-Jan-13 9:38
SledgeHammer0111-Jan-13 9:38 
GeneralRe: Latency In Button Click When Using MVVM Pin
Tee12311-Jan-13 10:14
Tee12311-Jan-13 10:14 
QuestionC# computer name rename Pin
EvetsMostel11-Jan-13 7:00
EvetsMostel11-Jan-13 7:00 
AnswerRe: C# computer name rename Pin
Jibesh11-Jan-13 7:47
professionalJibesh11-Jan-13 7:47 
GeneralRe: C# computer name rename Pin
EvetsMostel11-Jan-13 7:54
EvetsMostel11-Jan-13 7:54 
GeneralRe: C# computer name rename Pin
EvetsMostel11-Jan-13 11:30
EvetsMostel11-Jan-13 11:30 
GeneralRe: C# computer name rename Pin
EvetsMostel14-Jan-13 13:15
EvetsMostel14-Jan-13 13:15 
QuestionFTP Decryption Error Pin
Member 865395910-Jan-13 18:22
Member 865395910-Jan-13 18:22 
AnswerRe: FTP Decryption Error Pin
Bernhard Hiller10-Jan-13 21:46
Bernhard Hiller10-Jan-13 21:46 
GeneralRe: FTP Decryption Error Pin
Garth J Lancaster11-Jan-13 11:00
professionalGarth J Lancaster11-Jan-13 11:00 
AnswerRe: FTP Decryption Error Pin
Eddy Vluggen11-Jan-13 2:28
professionalEddy Vluggen11-Jan-13 2:28 
GeneralRe: FTP Decryption Error Pin
Garth J Lancaster11-Jan-13 11:00
professionalGarth J Lancaster11-Jan-13 11:00 
Questionhow to export a div to pdf Pin
shineskollam10-Jan-13 18:17
shineskollam10-Jan-13 18:17 
AnswerRe: how to export a div to pdf Pin
Richard MacCutchan10-Jan-13 21:51
mveRichard MacCutchan10-Jan-13 21:51 

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.