04-18-2002
more problems with my C program
I've run into 2 problems now, the first problem is probably a simple one it is in reguards to the argv[] pointer
I have an if statement as follows:
if(argv[1] == "-l")
{
printf("output:");
printf("TASK-NO\tDATE\tTIME\tTASK DESCRIPTION");
return(0);
}
but when I compile the program and type in
a.out -l
the if statement is not shown
what do I need to do to get this if statement working.
the second problem is I have a while loop that displays text via printf and then I use a gets to take in a string. I need the loop to be only broken when ctrl-d is pressed. I have NO idea of how to do this
if anyone has an idea let me know.
thanks
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I need some advise.
I have an application server running several applications. When I try and start a particular application when the others are running I receive the following. This is appearing in the core file that is created.
... (1 Reply)
Discussion started by: dbrundrett
1 Replies
2. Shell Programming and Scripting
Hey
First of all: I'm on a Mac. I'm quite new to this, so forgive me if i sound like a newb :-)
I wish to install the Deluge BitTorrent client. First of all I installed Macports and made it run smooth. But then I ran into a problem when I should install Deluge. I can post the log, and maybe... (4 Replies)
Discussion started by: Sixmax
4 Replies
3. UNIX for Dummies Questions & Answers
Hey all..
I have a problem with the BitTorrent client called Deluge. (Deluge BitTorrent Client). Followed the guide on their homepage, but can't get it to work.
First of all I have installed Xcode Tools 3.0 and MacPorts. I did the "sudo port install deluge" command, and all packages seemed to... (1 Reply)
Discussion started by: Sixmax
1 Replies
4. UNIX for Dummies Questions & Answers
Hi,
i want to write a script that executes a program (exec?) .
this program then requires a filename as input.
how do i give it this input in the script so the program will be complete run and close by the script.
e.g.
exec prog.exe
program then asks for filename
"enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies
5. Programming
Hello,
we are a group of students (mechanical engineering) who are trying to port UNIX-software to a PC Linux system during a study project. The first goals were achieved: compiling the Fortran code and creating object files. However, we encounter errors during the linking process.
This is... (0 Replies)
Discussion started by: Dynamo
0 Replies
6. Shell Programming and Scripting
My problem is that i want to calculate the day of the week, i want to change result given as a number for the day.
I mean, the program now do that if the day is Monday is represented by 0, Tuesday by 1.. but i want the word "Monday" as a result. I thought in a bucle if but there is always a... (3 Replies)
Discussion started by: mik4us
3 Replies
7. Programming
I use Ubuntu 10.4, and I installed GNUStep, Gorm (a gui builder) and ProjectCenter (the GNU alternative to Xcode) because I want to develop Objective-C apps. I opened the ProjectCenter and I created an application that displays only an empty window. I sourced the GNUstep.sh and I compiled the app. ... (0 Replies)
Discussion started by: mghis
0 Replies
8. Programming
I wrote a simple program that generates a random word 10,000,000 times.
I wrote it in python, then in C++ and compared the two completion times. The python script was faster! Is that normal? Why would the python script be faster? I was under the impression that C++ was faster. What are some of... (2 Replies)
Discussion started by: cbreiny
2 Replies
9. Homework & Coursework Questions
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies
10. Shell Programming and Scripting
I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade.
I have:
if ( $response =~ m/^/ ) {
$user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies
LEARN ABOUT PHP
maxdb_stmt_param_count
MAXDB_STMT_PARAM_COUNT(3) 1 MAXDB_STMT_PARAM_COUNT(3)
maxdb_stmt_param_count - Returns the number of parameter for the given statement
Procedural style
SYNOPSIS
int maxdb_stmt_param_count (resource $stmt)
DESCRIPTION
Object oriented style
int$maxdb_stmt->param_count ()
maxdb_stmt_param_count(3) returns the number of parameter markers present in the prepared statement.
RETURN VALUES
returns an integer representing the number of parameters.
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
if ($stmt = $maxdb->prepare("SELECT name FROM hotel.city WHERE name=? OR state=?")) {
$marker = $stmt->param_count;
printf("Statement has %d markers.
", $marker);
/* close statement */
$stmt->close();
}
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
if ($stmt = maxdb_prepare($link, "SELECT name FROM hotel.city WHERE name=? OR state=?")) {
$marker = maxdb_stmt_param_count($stmt);
printf("Statement has %d markers.
", $marker);
/* close statement */
maxdb_stmt_close($stmt);
}
/* close connection */
maxdb_close($link);
?>
The above example will output something similar to:
Statement has 2 markers.
SEE ALSO
maxdb_prepare(3).
PHP Documentation Group MAXDB_STMT_PARAM_COUNT(3)