Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

File Existance

sad.boysad.boy Member Posts: 90
here is what i need to know friends ;)

i give a path and a file name to the input and then the processes and if
the file exits gives me the messege tha "Files Exists" Otherwise it gives me the messege that file does not exist!
(for example the file neo.txt exists in the root directory of C partition,
and i input this path and file name to the program
c:
eo.txt then the messege the file exists is presented to me!)

Comments

  • PP2005PP2005 Member Posts: 111
    Just off the top of my head:

    [CODE]
    IF FileExists(FullPath + FileName) THEN Write('File exists')
    ELSE Write('File does not exist');
    [/CODE]

    In your example, FullPath := 'C:' and FileName := 'NEO.TXT'.


    : here is what i need to know friends ;)
    :
    : i give a path and a file name to the input and then the processes and if
    : the file exits gives me the messege tha "Files Exists" Otherwise it gives me the messege that file does not exist!
    : (for example the file neo.txt exists in the root directory of C partition,
    : and i input this path and file name to the program
    : c:
    eo.txt then the messege the file exists is presented to me!)
    :

  • sad.boysad.boy Member Posts: 90
    : Just off the top of my head:
    :
    : [CODE]
    : IF FileExists(FullPath + FileName) THEN Write('File exists')
    : ELSE Write('File does not exist');
    : [/CODE]
    :
    : In your example, FullPath := 'C:' and FileName := 'NEO.TXT'.
    :
    :
    : : here is what i need to know friends ;)
    : :
    : : i give a path and a file name to the input and then the processes and if
    : : the file exits gives me the messege tha "Files Exists" Otherwise it gives me the messege that file does not exist!
    : : (for example the file neo.txt exists in the root directory of C partition,
    : : and i input this path and file name to the program
    : : c:
    eo.txt then the messege the file exists is presented to me!)
    : :
    :
    :
    I guess You are wrong! at least its not right to my pascal!
    i searched and came up with 'filesearch' function but i did not get it!please guide me (please tell it with example like my own file ;))

    No One Knows What Is Like To Be The Sad Boy

  • zibadianzibadian Member Posts: 6,349
    : : Just off the top of my head:
    : :
    : : [CODE]
    : : IF FileExists(FullPath + FileName) THEN Write('File exists')
    : : ELSE Write('File does not exist');
    : : [/CODE]
    : :
    : : In your example, FullPath := 'C:' and FileName := 'NEO.TXT'.
    : :
    : :
    : : : here is what i need to know friends ;)
    : : :
    : : : i give a path and a file name to the input and then the processes and if
    : : : the file exits gives me the messege tha "Files Exists" Otherwise it gives me the messege that file does not exist!
    : : : (for example the file neo.txt exists in the root directory of C partition,
    : : : and i input this path and file name to the program
    : : : c:
    eo.txt then the messege the file exists is presented to me!)
    : : :
    : :
    : :
    : I guess You are wrong! at least its not right to my pascal!
    : i searched and came up with 'filesearch' function but i did not get it!please guide me (please tell it with example like my own file ;))
    :
    : No One Knows What Is Like To Be The Sad Boy
    :
    :
    This code should work in Turbo Pascal 6+:
    [code]
    {$I-}
    Assign(f, Filename);
    Reset(f);
    {$I+}
    if IOResult = 0 then
    Write('File exists')
    else
    Write('File does not exist');
    [/code]
  • PP2005PP2005 Member Posts: 111
    : I guess You are wrong! at least its not right to my pascal!
    : i searched and came up with 'filesearch' function but i did not get it!please guide me (please tell it with example like my own file ;))
    :
    : No One Knows What Is Like To Be The Sad Boy
    :
    :

    Well, what I supplied you with works in Borland Pascal 7.0, which is the version I use. Since you didn't write which version you program in, I couldn't really take that into account... ;o)
  • sad.boysad.boy Member Posts: 90
    : : I guess You are wrong! at least its not right to my pascal!
    : : i searched and came up with 'filesearch' function but i did not get it!please guide me (please tell it with example like my own file ;))
    : :
    : : No One Knows What Is Like To Be The Sad Boy
    : :
    : :
    :
    : Well, what I supplied you with works in Borland Pascal 7.0, which is the version I use. Since you didn't write which version you program in, I couldn't really take that into account... ;o)
    :
    Hey Thanks To u Guys! That Was Just a Cool Guide! ;)
Sign In or Register to comment.