Help!! my code won't work 
Author Message
 Help!! my code won't work

Hi
I have used a very simple bit of code to extract the date a file was
created. It works fine if run under dos but returns the current date
if run under NT
Can anyone tell me how to overcome this problem please?

begin
  Assign(f, paramstr(1));
  GetFTime(f,ftime); { Get creation time }
  UnpackTime(ftime,dt);
  with dt do
    begin
    WriteLn('File timestamp is ',
            hour,':',
            min,':',
            sec);
    end;
end.

+44 171 829 2302  These are my opionions



Wed, 18 Jun 1902 08:00:00 GMT  
 Help!! my code won't work

Thats only the beginning of the problem, it also returns the current date
in Windows 95 (figures)
If I find out anything I'll let you know



Quote:
> Hi
> I have used a very simple bit of code to extract the date a file was
> created. It works fine if run under dos but returns the current date
> if run under NT
> Can anyone tell me how to overcome this problem please?

> begin
>   Assign(f, paramstr(1));
>   GetFTime(f,ftime); { Get creation time }
>   UnpackTime(ftime,dt);
>   with dt do
>     begin
>     WriteLn('File timestamp is ',
>             hour,':',
>             min,':',
>             sec);
>     end;
> end.

> +44 171 829 2302  These are my opionions



Wed, 18 Jun 1902 08:00:00 GMT  
 Help!! my code won't work


19:48:28 in comp.lang.Pascal.borland, Mike Hinson

Quote:

>Hi
>I have used a very simple bit of code to extract the date a file was
>created. It works fine if run under dos but returns the current date
>if run under NT
>Can anyone tell me how to overcome this problem please?

>begin
>  Assign(f, paramstr(1));
>  GetFTime(f,ftime); { Get creation time }
>  UnpackTime(ftime,dt);
>  with dt do WriteLn('File timestamp is ', hour, ':', min, ':', sec);
>end.

Looks like GetFTime gets the wrong data.  See what FindFirst gets; it
might be better.
--

    http://www.merlyn.demon.co.uk/


Wed, 18 Jun 1902 08:00:00 GMT  
 Help!! my code won't work

Quote:

>Thats only the beginning of the problem, it also returns the current date
>in Windows 95 (figures)
>If I find out anything I'll let you know

For me it returns the time of the last reboot (interesting)

Quote:


>> Hi
>> I have used a very simple bit of code to extract the date a file was
>> created. It works fine if run under dos but returns the current date
>> if run under NT
>> Can anyone tell me how to overcome this problem please?

>> begin
>>   Assign(f, paramstr(1));

as the online help states GetFtime needs an open file
so you have to
       reset(f);

Quote:
>>   GetFTime(f,ftime); { Get creation time }
       close(f);
>>   UnpackTime(ftime,dt);
>>   with dt do
>>     begin
>>     WriteLn('File timestamp is ',
>>             hour,':',
>>             min,':',
>>             sec);
>>     end;
>> end.

>> +44 171 829 2302  These are my opionions

hth fsg
FSG


Wed, 18 Jun 1902 08:00:00 GMT  
 Help!! my code won't work


Quote:



>>> Hi
>>> I have used a very simple bit of code to extract the date a file was
>>> created. It works fine if run under dos but returns the current date
>>> if run under NT
>>> Can anyone tell me how to overcome this problem please?

>>> begin
>>>   Assign(f, paramstr(1));
>as the online help states GetFtime needs an open file

It works, thanks. However the online help for my old 5.5 version of
pascal gives a rather muddled example which dosn't clearly show the
need to open the file. Interstingly it works with a closed file under
DOS.

=========================================

+44 171 829 2302 These are my views.
==========================================



Wed, 18 Jun 1902 08:00:00 GMT  
 Help!! my code won't work

Quote:
> >>> I have used a very simple bit of code to extract the date a file was
> >>> created. It works fine if run under dos but returns the current > >>> date if run under NT
> >>> Can anyone tell me how to overcome this problem please?
> >>> begin
> >>>   Assign(f, paramstr(1));
> >as the online help states GetFtime needs an open file

> It works, thanks. However the online help for my old 5.5 version of
> pascal gives a rather muddled example which dosn't clearly show the
> need to open the file. Interstingly it works with a closed file under
> DOS.

   Any file DOS accesses is implicitly "opened" for DOS, by action and
definition - all files DOS sees are logically "open" to it.  OTOH, an
application program must "open" any file it uses, so DOS (or whatever
o/s is active) can manage its use with other activities in the system -
"opening" a file in an application just reserves its use for a
particular application purpose, and DOS/whatever then knows it's
reserved for exclusive/shared use within the system.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. HELP! Help won't work

2. DBGrid won't work right

3. Turbo Pascal for Windows doesn't quite work w/ Win 95

4. Search won't work - Why? #2

5. Search won't work - why?

6. TEmsStream won't work in protected mode

7. tp70 won't work with athlon?

8. Why Age Check Function Won't Work?

9. Why Delete Procedure Won't Work?

10. Why Age Check Function Won't Work?

11. Why Delete Procedure Won't Work?

12. Borland Pascal7 debugger won't work with Windows95

 

 
Powered by phpBB® Forum Software