Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

silly C problem

  • 09-08-2004 8:47am
    #1
    Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭


    Hey people,

    Something funny is happening when I write out to file. I was given a specific file format and I'm trying to get my program to generate this file format.

    The file format has three columns and multiple rows depending on how much data you gave. 1 row = 1 sample.

    I've written the code for writing to file, but when I open the file using notepad, "\n" seems not to have been interpreted as a newline, and all that is displayed is a black square where the newline should have been....

    I dont know if the problem is with the way notepad is interpreting the "\n", or if the problem is with my code?

    The file extension is .dat btw

    Thanks,
    Martin


Comments

  • Registered Users, Registered Users 2 Posts: 678 ✭✭✭briano


    try using textpad (http://www.textpad.com free to download)to view the dat files, It should display them properly. I had the same problem with notepad myself


  • Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭king_of_inismac


    Thanks man,

    That has solved it! :D


  • Closed Accounts Posts: 47 PhilH


    Hi guys.

    What's happening here is that Windows expects a new line in a text file to be written as CR-LF (carraige return, ascii 13, followed by line feed, ascii 10). In
    C this is "\r\n".

    Unix, amonst other operating systems, expects just the \n.

    Some text editors, like WordPad, or TextPad, but not Notepad, are smart enough to interpret either convention.

    So, depending on who should be using the file you may still be in trouble. Strictly, your file does not contain valid line feed characters for Windows.

    PHiL


Advertisement