ASCII cuestion

This is a discussion on ASCII cuestion within the C++ Programming forums, part of the General Programming Boards category; I have a little cuestion... what is the ASCII number for the enter?? I have the next code: #include <fstream.h> ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    7

    Question ASCII cuestion

    I have a little cuestion... what is the ASCII number for the enter??

    I have the next code:

    #include <fstream.h>

    void main()
    char a[10];
    ifstream file("abc.txt");
    int line=1;
    while(!file.eof()){
    if(char[0]=="ascii number")
    linea++;
    }
    }

    what I need is to record the number of the line that I'm reading.

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    It depends on how you're reading the input.

    Unless you're reading in binary mode (or are doing something strange with file.get() or file.getline()) you'll probably never read an 'enter' into one of your arrays.

    Using the text input functions will stop reading at the end of line so you don't have to check for it's presence.
    zen

  3. #3
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    'enter' or 'return' can mean different things... but there are two characters which serve this purpose... 10 and 13... the CR [carriage return] and LF [line feed]...

    er, i may have them switched...

    hth! [or at least a 50 percent chance of so...]
    hasafraggin shizigishin oppashigger...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ASCII character with ASCII value 0 and 32
    By hitesh_best in forum C Programming
    Replies: 4
    Last Post: 07-24-2007, 09:45 AM
  2. Replies: 11
    Last Post: 03-24-2006, 10:26 AM
  3. Office access in C/C++ NOT VC++!! :)
    By skawky in forum C++ Programming
    Replies: 1
    Last Post: 05-26-2005, 01:43 PM
  4. ascii values for keys
    By acid45 in forum C Programming
    Replies: 2
    Last Post: 05-12-2003, 07:13 AM
  5. Checking ascii values of char input
    By yank in forum C Programming
    Replies: 2
    Last Post: 04-29-2003, 07:49 AM

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