The function prototype:
I was working on the basis it was probably something to do with the version of gcc in use - however compat libs and gcc3 do not seem to fix it.
Hi, I'm converting a C program that I made using the Visual Studio. I now use GCC (over Linux) and can't find some equivalences. I changed my __int64 definitions to unsigned long long, but can't find an equivalent to the microsoft i64toa() function, which let you convert a char* to a 64 bit... (1 Reply)
hello everybody!
I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(){
int fileDescriptor;
fileDescriptor =... (2 Replies)
I have an HP PPM (ITG) application that is running an awk command in cygwin bash shell as part of ITG process moving SAP transports on a Windows 2003 server. The awk command checks the first two characters of a file containing return code that was retrieved from the SAP server. It is throwing the... (3 Replies)
hello everybody!
i have aproblem! i dont know how to concatenate const char* with char
const char *buffer;
char *b;
sprintf(b,"result.txt");
strcat(buffer,b);
thanx in advance (4 Replies)
I am writing some code in C++ to print a message using fprintf
Here is an example
void pr_desc(
FILE* stream,
int shift,
const char* desc) {
const char* format="%*s\e;
fprintf(stream,format,shift,"",desc);
}
I call it using
const char* desc;
... (4 Replies)
Dear all,
I am using C and ROOT for programming. And I need to incorporate following in my code.
char *fps=NULL;
int dec=0,sign=0;
float mean = h1->GetMean(1); //0.001298
fps= fcvt(mean,6 , &dec, &sign);
I need to provide this mean as const char to some other function to get... (8 Replies)
Hello there,
I am new to the awk scripting and getting the following error while running the script. Please can you advise me how to resolve this . Thanks
./sub_del_awk_lat.sh
awk: cmd. line:5: warning: escape sequence `\/' treated as plain `/'
awk: cmd. line:5: sed -n... (6 Replies)
Pointers are seeming to get the best of me and I get that error in my program.
Here is the code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define REPORTHEADING1 " Employee Pay Hours Gross Tax Net\n"
#define REPORTHEADING2 " Name ... (1 Reply)
I have a problem at make step to install a downloaded package consisted of different programs.
In file included from kcdbext.cc:16:0:
kcdbext.h: In member function �char* kyotocabinet::IndexDB::get(const char*, size_t, size_t*)’:
kcdbext.h:1281:14: error: cannot convert �bool’ to... (3 Replies)
Discussion started by: yifangt
3 Replies
LEARN ABOUT MINIX
getopt
GETOPT(3) Library Functions Manual GETOPT(3)NAME
getopt - get option letter from argv
SYNOPSIS
int getopt(argc, argv, optstring)
int argc;
char **argv;
char *optstring;
extern char *optarg;
extern int optind;
DESCRIPTION
Getopt returns the next option letter in argv that matches a letter in optstring. Optstring is a string of recognized option letters; if a
letter is followed by a colon, the option is expected to have an argument that may or may not be separated from it by white space. Optarg
is set to point to the start of the option argument on return from getopt.
Getopt places in optind the argv index of the next argument to be processed. Because optind is external, it is normally initialized to
zero automatically before the first call to getopt.
When all options have been processed (i.e., up to the first non-option argument), getopt returns EOF. The special option -- may be used to
delimit the end of the options; EOF will be returned, and -- will be skipped.
DIAGNOSTICS
Getopt prints an error message on stderr and returns a question mark (?) when it encounters an option letter not included in optstring.
EXAMPLE
The following code fragment shows how one might process the arguments for a command that can take the mutually exclusive options a and b,
and the options f and o, both of which require arguments:
main(argc, argv)
int argc;
char **argv;
{
int c;
extern int optind;
extern char *optarg;
.
.
.
while ((c = getopt(argc, argv, "abf:o:")) != EOF)
switch (c) {
case `a':
if (bflg)
errflg++;
else
aflg++;
break;
case `b':
if (aflg)
errflg++;
else
bproc();
break;
case `f':
ifile = optarg;
break;
case `o':
ofile = optarg;
break;
case `?':
default:
errflg++;
break;
}
if (errflg) {
fprintf(stderr, "Usage: ...");
exit(2);
}
for (; optind < argc; optind++) {
.
.
.
}
.
.
.
}
HISTORY
Written by Henry Spencer, working from a Bell Labs manual page. Modified by Keith Bostic to behave more like the System V version.
BUGS
It is not obvious how `-' standing alone should be treated; this version treats it as a non-option argument, which is not always right.
Option arguments are allowed to begin with `-'; this is reasonable but reduces the amount of error checking possible.
Getopt is quite flexible but the obvious price must be paid: there is much it could do that it doesn't, like checking mutually exclusive
options, checking type of option arguments, etc.
4.3 Berkeley Distribution May 27, 1986 GETOPT(3)