need help with C access times of files


 
Thread Tools Search this Thread
Top Forums Programming need help with C access times of files
# 1  
Old 02-17-2011
Error need help with C access times of files

i am just checking the access times of files in C, but i am unsure about something

say i have a c program called acc.c (only file in directory)
then i compile it and get acc
then i ran acc and it tells me all the files in the current directory thats access time is only later than acc.c
for some reason acc pops up? is this right? i didnt open acc....just compiled it and ran it...

Last edited by omega666; 02-17-2011 at 02:38 AM..
# 2  
Old 02-17-2011
Yes.

access time means the time it was last read, executed, or written. You have to open and execute compiled image file in order to run it.
# 3  
Old 02-17-2011
i just noticed, acc is not supposed to come up, because after you run acc, it gets the access times of acc.c so acc.c gets accessed , so really acc is not supposed to come up right?
# 4  
Old 02-17-2011
Without seeing the source code for your application and without seeing how you ran the resulting executable I have no idea what it's actually doing and what it should be doing.
# 5  
Old 02-17-2011
i ran the program like so
clear
dos2unix acc.c acc.c
gcc -Wall -g -o acc acc.c.
touch .test
./acc -b acc.c (this makes it only check for modification time)
./acc acc.c (this only checks for access time)


for the last result, i think i am supposed to get only .test, but for some reason i get .test and acc

so if i run the code to get the access time, i will get the access time , then update that files access time?
# 6  
Old 02-17-2011
You still haven't posted the source code of the program so I can't tell what it's supposed to be doing and why it's not.

You haven't posted what it actually printed, either.

Code:
$ cat file.c
sourc code of program
$ ./stuffItyped
stuffitprints
$ ./nextthingItyped
stuffthatprinted

Until service gets back to me about my crystal ball, these are the things to tell what you're actually doing and how it's not working.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Counting number of times content in columns occurs in other files

I need to figure out how many times a location (columns 1 and 2) is present within a group of files. I figured using a combination of 'while read' and 'grep' I could count the number of instances but its not working for me. cat file.txt | while read line do grep $line *08-new.txt | wc -l... (6 Replies)
Discussion started by: ncwxpanther
6 Replies

2. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

3. Shell Programming and Scripting

How to access files from different directories and to perform search action in those files?

Hi, I want to access files from different directories (for example: /home/dir1/file1 , /home/dir2/file2 ...) Like this i have to access these files(file1, file2...). (3 Replies)
Discussion started by: bangarukannan
3 Replies

4. UNIX for Dummies Questions & Answers

kernel giving access for multiple users to access files

hi all, i want to know y kernel is giving access for multiple users to access a file when one user may be the owner is executing that file. Because other user can manipulate that file when the other user is executing that file, it will give the unexpected result to owner . plz help me... (1 Reply)
Discussion started by: jimmyuk
1 Replies

5. UNIX for Dummies Questions & Answers

Copying files multiple times increasing sequentially

I am looking for the easiest way to copy a set of files 1000 times and increment sequentially. I want to copy these 2 files: Scenario.1.1.ud Scenario.1.2.ud So that it creates the following: Scenario.2.1.ud Scenario.2.2.ud Scenario.3.1.ud Scenario.3.2.ud .. .. Scenario.1000.1.ud... (2 Replies)
Discussion started by: JPOrlando
2 Replies

6. AIX

how would you know your server was rebooted 3 times or 5 times

Is there such location or command to know how many times did you reboot your server in that particular day?in AIX. (3 Replies)
Discussion started by: kenshinhimura
3 Replies

7. Shell Programming and Scripting

ls -l all files created between two times

solaris 8 and solaris 10 c shell I have a /local/tmp/ directory that is cleared out every day and files are created in it all day long from 0000 - 2359 (24 hour clock) A new file is created in this directory every couple of minutes. I want a script "rrtime" that takes two arguments hhmm1 and... (4 Replies)
Discussion started by: ajp7701
4 Replies

8. SCO

Find access times

I am working on a SCO Unixware 7.1.4 server and I have been asked to determine over the last year when a file was accessed, not just the last time it was accessed. Is there anyway to figure this out? Thanks in advance, Kevin Harnden (1 Reply)
Discussion started by: chefsride
1 Replies

9. UNIX for Dummies Questions & Answers

Last modification times of files less than 6 months old

How do I get the modification time for files less than 6 months old? (It seems for fles as old or older than this I get to see only the day,month and year. I tried the option -u but it gives me the last accessed time) (1 Reply)
Discussion started by: Abhishek Ghose
1 Replies

10. UNIX for Dummies Questions & Answers

Need help to access/mount so to access folder/files on a Remote System using Linux OS

Hi I need to access files from a specific folder of a Linux system from an another Linux System Remotely. I know how to, Export a folder on One SCO System & can access the same by using Import via., NFS in the Sco Unix SVR4 System using the scoadmin utility. Also, I know to use mount -t ... (2 Replies)
Discussion started by: S.Vishwanath
2 Replies
Login or Register to Ask a Question