Streams related questions..

This is a discussion on Streams related questions.. within the C Programming forums, part of the General Programming Boards category; [list=1][*]When opening a file (fopen) , whats the difference between string and binary modes?? or in other words , why\when ...

  1. #1
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472

    Streams related questions..

    [list=1][*]When opening a file (fopen) , whats the difference between string and binary modes?? or in other words , why\when would i use one over the other??
    [*]why do data stored in binary mode looks like gibberish??
    [*] how do i save a file with a name that has more than 7
    characters preceding the dot such as "textfilename.txt" ?? my compiler truncates the name till it becomes "textfil.txt"..
    [*] Can anyone explain (or point me to a site) that shows clearly\simply (with diagrams if possible) the relation between a File , its stream and how data transfers back and forth between them?[/list=1]


    Appreciate your help

    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  2. #2
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Try the FAQ at this website. Google is another option.
    The world is waiting. I must leave you now.

  3. #3
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    Well i've checked the FAQ before asking and it doesn't answer any of my questions.

    And i've searched google too but all what i've got was either C projects code or refferences to other languages.

    Please answer as many as you can\want or link me to a site that answers my question(s). I really got tired of searching..
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  4. #4
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    I'm not sure if this will anwser all your questions, but here's the MSDN's info on the function: http://msdn.microsoft.com/library/de...c_._wfopen.asp . Regarding your third question though, it's possible the reason for this is that you're using a severely out of date version of the function, in which case you'll need to update your includes.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    1) Binary mode is a raw stream of characters. No translations are made for values that are treated specially by the system, such as end-of-file. A binary file may contain valid data that matches the end-of-file code. If the file were opened in text mode that translation would be made and you would improperly read the contents.

    2) Because it isn't supposed to be a printable format. When you open a binary file in a text editor, the editor tries its best to represent the nonprintable characters, resulting in gibberish.

    3) That's an implementation defined issue. Get a better compiler.

    4) Not clearly/simply. The concept is rather difficult, so any decent explanation will appear obscure. Take a look at "The Standard C Library" by P. J. Plauger, it describes the streaming system and implements it completely.
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Mar 2004
    Posts
    15
    dude is write what compiler do you have are you using windows or linux, the linux compiler gcc comes as standard use that if not get ms dev studio.

  7. #7
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    Thanks alot for the replies guys , especially Prelude .
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2 File Related Questions
    By lruc in forum C Programming
    Replies: 4
    Last Post: 12-31-2008, 06:56 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 08:44 AM
  4. Two Object related question
    By gflores in forum C++ Programming
    Replies: 3
    Last Post: 08-18-2004, 05:29 AM
  5. non program related questions about C
    By Nova in forum C Programming
    Replies: 3
    Last Post: 10-16-2001, 03:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21