No error but not executing

Thread Tools Search this Thread
Top Forums Programming No error but not executing
# 1  
Old 12-10-2010
No error but not executing

Hi friends
NO errors, but when I try to execute the program it gets struck.
Can any one find it out.


main(int argc, char *argv[])
int fd,changes,i,random_spot,kids[2];
struct stat buf;
char *the_file,*starting_string="Finally got it! \n";
size_t length=strlen(the_file);
size_t starting=strlen(starting_string);
if (argc!=2)
fprintf(stderr, "Usage %s file_name \n",*argv);
if((fd=open(argv[1], O_CREAT | O_RDWR,0666))<0)
fprintf(stderr,"open error on file %s\n",*argv);
fprintf(stderr,"fstat error on file %s\n",*argv);
fprintf(stderr,"mmap failure\n");
if(*(the_file+i)>='0' && *(the_file+i)<='9')
printf("Parent done with changes\n");
printf("The file now contains:\n%s\n",the_file);

Moderator's Comments:
Mod Comment Double post, continued here
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Error when executing script

Hi, I wrote this script to test if the output for DIR1 and DIR2 comes out as I want : #!/bin/bash DAY=$(date +%d) MONTH=$(date +%b) YEAR=$(date +%Y) DIR1=$($MONTH$YEAR"_Blast_BC01") DIR2=$($MONTH$YEAR"_Blast_BC15") echo $DIR1 echo $DIR2 This is the output I want for echo $DIR1 ... (12 Replies)
Discussion started by: anaigini45
12 Replies

2. Programming

Error in executing the C program

Hello Friends, I have written a code for the unisex bathroom which makes a policy that when a woman is in the bathroom only other women may enter, but not men, and vice versa. This program consists of four functions which a user defines but these functions are not properly working while... (4 Replies)
Discussion started by: Ravi Tej
4 Replies

3. UNIX for Dummies Questions & Answers

Error executing the script

I have the following script owned by dwdev account and group dwdev, the permissions on the script are as follows. -rw-r-x--- 1 dwdev dwdev 279 Sep 17 13:19 Groups: cat /etc/group | grep dwdev dwdev:x:704:dwdev dwgroup:x:725:dwdev writers:x:726:dwdev User: cat /etc/passwd |... (3 Replies)
Discussion started by: Ariean
3 Replies

4. Linux

Error executing a variable

greetings, i'll try to keep this simple... i have a script that sets up my environment and creates a command line variable to execute. when i execute the variable i get an error telling me it cannot open one of the files on the command line. the error prints a file name that is definitely... (7 Replies)
Discussion started by: crimso
7 Replies

5. Shell Programming and Scripting

Error while executing sh command

Hi, I have 2 files and as follows: =========== =========== echo "session1" sh echo "exit session2 and enter session1" ================================= ============= ============= echo "session2" sh echo "exit session2"... (5 Replies)
Discussion started by: RP09
5 Replies

6. Shell Programming and Scripting

Error executing script

Please delete de thread. Thanks. (10 Replies)
Discussion started by: Rodrih92
10 Replies

7. Programming

No error but not executing

Hi friends When I compile thic program by gcc filename, it shows no error. But after that if I execute the program gets stuck. Can any one find out. #include<stdio.h> #include<sys/types.h> #include<sys/mman.h> #include<stdlib.h> #include<fcntl.h> #include<sys/stat.h>... (6 Replies)
Discussion started by: gokult
6 Replies

8. UNIX for Dummies Questions & Answers

Error Executing the script.

Hi , I m getting an error after executing the script. My script. Script is used to find out the date on 8 different machines(mentioned in SERVERNAMES file). I have added public key to avoid ssh password and ssh without password working fine. #!/bin/sh fn_VMFind() { Date=`ssh -t... (5 Replies)
Discussion started by: pinga123
5 Replies

9. Shell Programming and Scripting

Error while executing a script

My script is as below : #!/bin/sh for line in `cat Results.txt` do FEILD1=`echo $line |awk -F"|" '{print $1}'` FEILD2=`echo $line |awk -F"|" '{print $2}'` FEILD3=`echo $line |awk -F"|" '{print $3}'` FEILD4=`echo $line |awk -F"|" '{print $4}'` echo "$FEILD1 $FIELD2 $FIELD3 $FIELD4" done ... (15 Replies)
Discussion started by: shwetainnani
15 Replies

10. Shell Programming and Scripting

error while executing the script

Hello I am executing the following script nawk 'NR == 1 || substr($0,63,5) ~ /H... / && \ _++ == 2 { fn && close(fn); fn = "part_" ++c; _ = 1 } { print > fn }' sample.dat When i execute as it is it is executing fine. but when i execute the whole script as a single line like below ... (2 Replies)
Discussion started by: dsdev_123
2 Replies
Login or Register to Ask a Question

Featured Tech Videos