using usleep in c++ on diff platforms


 
Thread Tools Search this Thread
Top Forums Programming using usleep in c++ on diff platforms
# 1  
Old 02-19-2004
using usleep in c++ on diff platforms

Hi,

I'm using the command usleep (500000) when compiling C++ on the SunOS platform, but it does not compile on a OSF1 platform?
Any ideas?

Thanks
# 2  
Old 02-19-2004
What error are you getting? I'll bet it's just that usleep() is not there.
# 3  
Old 02-19-2004
It says that usleep is not defined
i.e.
line 1690: identifier "usleep" is undefined
usleep ( 500000 );

if I define it as an int then it compiles but the process does not actually sleep.
# 4  
Old 02-19-2004
It's not enough to define it. You also need to write it.

Try using select(). I think OSF has that. See this post for an example.
# 5  
Old 02-19-2004
Thanks for the help, I found what the problem was and for any future reference I have described it below:

In my header file I have a section the "ifdef OSF Platform" then add in extra defines that are not required on the sun platform. In this section I had to add in the line:

#define _XOPEN_SOURCE_EXTENDED

The result of this was that when the routine was called and accessed the unistd.h library file it activated the usleep routine (Which wasn't being activated before). Hence when I run the code it now sleeps as its supposed to!
# 6  
Old 02-19-2004
Thanks for providing the solution to your problem instead of just saying, "I figured it out". Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Diff 3 files, but diff only their 2nd column

Guys i have 3 files, but i want to compare and diff only the 2nd column path=`/home/whois/doms` for i in `cat domain.tx` do whois $i| sed -n '/Registry Registrant ID:/,/Registrant Email:/p' > $path/$i.registrant whois $i| sed -n '/Registry Admin ID:/,/Admin Email:/p' > $path/$i.admin... (10 Replies)
Discussion started by: kenshinhimura
10 Replies

2. Shell Programming and Scripting

serach diff filename in diff location using shell scripting

Hi, I am new to shell scripting. please help me to find out the solution. I need a script where we need to read the text file(consists of all file names) and get the file names one by one and append the date suffix for each file name as 'yyyymmdd' . Then search each file if exists... (1 Reply)
Discussion started by: Lucky123
1 Replies

3. Shell Programming and Scripting

.procmailrc and uudeview (put attachments from diff senders to diff folders)

Moderator, please, delete this topic (1 Reply)
Discussion started by: optik77
1 Replies

4. UNIX and Linux Applications

Platforms using Unix

Hi ;) Which hardware platforms/machine types use the Operating System Unix? A list of all would be appreaciated Thx Megadrink :cool: (2 Replies)
Discussion started by: Megadrink
2 Replies

5. Solaris

usleep command is not available in SunOS

Hi All, I need usleep command to use in one of my shell script. I am working on SunOS 5.9. Where usleep command is not available. Is there any way to use usleep command in SunOS. Thanks In Advance, chidhu (5 Replies)
Discussion started by: pa.chidhambaram
5 Replies

6. Shell Programming and Scripting

Simulate SVN diff using plain diff

Hi, svn diff does not work very well with 2 local folders, so I am trying to do this diff using diff locally. since there's a bunch of meta files in an svn directory, I want to do a diff that excludes everything EXCEPT *.java files. there seems to be only an --exclude option, so I'm not sure... (3 Replies)
Discussion started by: ackbarr
3 Replies

7. UNIX for Dummies Questions & Answers

zipping across platforms

I saw a few posts on this, however, I am getting an error and don't see this particular issue. Not right off anyways.... We moved from digital OS to solaris 9 in Jan. On the old platform, I could gzip my files, ftp them to my win2000 desktop via hummingbird and then unzip them to view. Now,... (8 Replies)
Discussion started by: MizzGail
8 Replies

8. UNIX for Dummies Questions & Answers

what do one mean when referring to 'platforms'?

what do one mean when referring to 'platforms'? (examples of platforms as listed below) alpha amd64 i386 ia64 pc98 sparc64 Thanks! (1 Reply)
Discussion started by: ninelives1980
1 Replies

9. Programming

Makefile across platforms

EXE=auto SRCS=auto.cpp debug.cpp OBJS=auto.o debug.o CXX=g++ #HOSTFLAG=-DLinux HOSTFLAG=-DSunOS # Do not use compiler optimizer -O as this may break the program # Use debug flag to enable the debug() function. If DEBUG is not # defined than the function debug() is set to void(),... (1 Reply)
Discussion started by: laila63
1 Replies

10. Shell Programming and Scripting

diff 2 files; output diff's to 3rd file

Hello, I want to compare two files. All records in file 2 that are not in file 1 should be output to file 3. For example: file 1 123 1234 123456 file 2 123 2345 23456 file 3 should have 2345 23456 I have looked at diff, bdiff, cmp, comm, diff3 without any luck! (2 Replies)
Discussion started by: blt123
2 Replies
Login or Register to Ask a Question