Sponsored Content
Full Discussion: dilemma in control flow
Top Forums Programming dilemma in control flow Post 98706 by tej.buch on Friday 10th of February 2006 08:54:39 AM
Old 02-10-2006
dilemma in control flow

hello im facing a queer problem when i execute the foll code in unix

Code:
# include <stdio.h>
# include <unistd.h>

main(int argc,char *argv[])
{
	FILE *fp = fopen("/ras/chirag/fifotest/file.fifo","a");
	int i=1;
	fprintf(fp,argv[1]);
	printf("I SLEEP");
	system("date");
	for (i=0;i<50;i++)
	{
	//printf("do nothing\n");
	}
	i=sleep(25);
	printf("%d",i);
	printf("I WAKE UP");
	system("date");
	fclose(fp);
}

the above code first executes the date command and then sleeps for 25 secs and then prints the strings "I SLEEP" and "I WAKE UP" in the end...

the output i obtained is:
Code:
Fri Feb 10 19:10:16 CST 2006
Fri Feb 10 19:10:41 CST 2006
I SLEEP0I WAKE UP


can anyone help me why is such a flow occuring and what can be done to get it the normal way? thanks in advance............
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to assign correct control flow?

how can i create a script with a correct control flow/loop(?) to provide output from 3 files? file1 one two three file2 yellow red orange file3 banana apples cantaloupes output file: one (1 Reply)
Discussion started by: apalex
1 Replies

2. UNIX for Dummies Questions & Answers

A Terminal Dilemma

Hi everyone, I hope this is the right place to ask this question... I have a contract to convert a mainframe/DB2 application to using AIX/Oracle. Everything went fine but we are now running into a terminal problem. With the Mainframe app, the clients had great response time from remote... (5 Replies)
Discussion started by: rocky_triton
5 Replies

3. IP Networking

Disabling 802.3x flow control

I have a server I would like to disable 802.3x flow control on. The host is Linux (CentOS 4.4 x86_64 w/ 2.6.9-42.0.3.EL kernel,) and I'm using the ns83820 driver for the ethernet interface in question. I've tried looking at the driver parameters (modinfo ns83820) and using ethtool (ethtool -a... (0 Replies)
Discussion started by: LivinFree
0 Replies

4. Solaris

DiskSuite dilemma

Hello, We have this system a SunFire 280R running Solaris 8 Generic_117350-46. It has 2 36GB disks in it. They are mirrored with DiskSuite 4.2.1. When we execute a metastat all the devices report an Okay status, but when we go into metatool everything is in the Critical (maintenance)... (4 Replies)
Discussion started by: mgb
4 Replies

5. Shell Programming and Scripting

Python script - control flow statements

Hi guys.I'm just beginner of python. I'm just trying to do some analysis on simple input file. it has 6 columns and i want to consider k,l and m,n if i and j are + after that checking which value is greater or lower in k,l and m,n I have included logic header just to explain what I was... (4 Replies)
Discussion started by: repinementer
4 Replies

6. Shell Programming and Scripting

Flow Control in CSH

hi , I am new to scripting, i have a doubt can any one pls solve it for me the code is not working set users = (user1 user2 user3) echo The users are echo $users echo Enter the USER NAME set USER_NAME = $< set i = 1; for ( i = 1; i <= $#users; i++ ) if ( $USER_NAME == $users )... (1 Reply)
Discussion started by: Manju87
1 Replies

7. Shell Programming and Scripting

Backup script using Korn Flow Control

I am wiping off the dust to my shell scipting days and had this question: I have this script that I have created, and cannot figure out where my flow control issue is within this script. #!/bin/ksh #Basic script to backup server #Home directories to the external ... (2 Replies)
Discussion started by: metallica1973
2 Replies

8. Shell Programming and Scripting

Help with control flow in a Bash script

In my bash script I want to say "if argument 2 is anything except x, y or z, than echo this" (x y and z being words). So my script looks like this: if ] then echo "unrecognized input: $2" fi This usually works but than I also want to say "if argument 2 IS x, y, or z, but argument 4 is... (4 Replies)
Discussion started by: Jrodicon
4 Replies

9. UNIX for Dummies Questions & Answers

Flow control state changed in server logs

Hi, We observe below logs from switch - the database servers rebooted becaause they couldn't do I/O on vfiler -Any pointers looking at below logs please? Switch logs: 2016 Apr 30 07:41:16.729 EAG-ECOM-POD111GPU-SWF1 %ETHPORT-5-IF_DOWN_LINK_FAILURE: Interface Ethernet152/1/8 is down (Link... (0 Replies)
Discussion started by: admin_db
0 Replies
CACOS(3)						     Linux Programmer's Manual							  CACOS(3)

NAME
cacos, cacosf, cacosl - complex arc cosine SYNOPSIS
#include <complex.h> double complex cacos(double complex z); float complex cacosf(float complex z); long double complex cacosl(long double complex z); Link with -lm. DESCRIPTION
The cacos() function calculates the complex arc cosine of z. If y = cacos(z), then z = ccos(y). The real part of y is chosen in the interval [0,pi]. One has: cacos(z) = -i * clog(z + i * csqrt(1 - z * z)) VERSIONS
These functions first appeared in glibc in version 2.1. CONFORMING TO
C99. EXAMPLE
/* Link with "-lm" */ #include <complex.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main(int argc, char *argv[]) { double complex z, c, f; double complex i = I; if (argc != 3) { fprintf(stderr, "Usage: %s <real> <imag> ", argv[0]); exit(EXIT_FAILURE); } z = atof(argv[1]) + atof(argv[2]) * I; c = cacos(z); printf("cacos() = %6.3f %6.3f*i ", creal(c), cimag(c)); f = -i * clog(z + i * csqrt(1 - z * z)); printf("formula = %6.3f %6.3f*i ", creal(f), cimag(f)); exit(EXIT_SUCCESS); } SEE ALSO
ccos(3), clog(3), complex(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2011-09-15 CACOS(3)
All times are GMT -4. The time now is 07:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy