Sponsored Content
Top Forums Programming How to call Linux command in C Post 302136017 by draaghduhl on Friday 14th of September 2007 06:00:58 AM
Old 09-14-2007
Quote:
Originally Posted by sriram003
main()
{
system("split -l 50 -a 1 /absolutepath/sample.txt");
return 0;
}
If you could provide the return-value of system, one could examine why the call is failing.

try:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(const int argc, const char* const* const argv) {
 int res;
 int err;
 res = system("split -l 50 -a 1 /absolutepath/sample.txt");
 fprintf(stdout,"execution returned %d.\n",res);
 if ((-1 != res) && (127 != res))
  fprintf(stdout,"now would be a good time to check out 'man split' to check what the resulting return-value (%d) means.\n",res);
 return res;
}

 

10 More Discussions You Might Find Interesting

1. Linux

Making Socket System Call From Linux Kernel Module?

Hi Everyone! How can we make a socket() system call from a linux module executing in kernel space? If any one knows, kindly tell me. It will be great. I want to use the socket interface in linux kernel space for sending raw packets over the network. Hamayun (0 Replies)
Discussion started by: mian_m_hamayun
0 Replies

2. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies

3. Shell Programming and Scripting

How to call a Linux command in C prog.

Dear Friends, I want to know how to call a Linux commands in C programs. (1 Reply)
Discussion started by: krishna_sicsr
1 Replies

4. UNIX for Advanced & Expert Users

ioctl() system call on Linux-i386

Greetings, Please help me with the following : Where can I find what means exactly and how to use each of the second argument of the ioctl() system call in Linux/386 : FIOxxx (file IOCTL requests), SIOxxx (socket IOCTL requests), TCxxx TIOxxx (terminal IOCTL requests) ? ... (1 Reply)
Discussion started by: aigoia
1 Replies

5. Linux

How to implement a system call in linux?

I encountered a variety of difficulties when implementing a system call as simple as HelloWorld example in Linux so far. Firstly, according to the book "Linux Kernel Development Second Edition", I tried to implement a syscall in 2.6.31 but no way absolutely because 2.6.10 has a very different way... (5 Replies)
Discussion started by: sunnyhay
5 Replies

6. Windows & DOS: Issues & Discussions

How to call a command in a batch file?

Hi, I would like to get the output of below command emailed to me in a windows2003 server. "bpimagelist -hoursago 24 -U" I will be using "blat" to email the output of this command.But not sure how the above command is called for in a batch file when executed. Would appreciate if... (1 Reply)
Discussion started by: Hari_Ganesh
1 Replies

7. Shell Programming and Scripting

Perl - Call a sub routine in a command

Hi all I have written a simple perl script that has different options i.e. myscript -l -p etc i have it so when it runs without any switches it runs a subroutine called nvrm_norm i want to be able to do a -p option and run pall -w -f and then called the subruotine pall is... (1 Reply)
Discussion started by: ab52
1 Replies

8. Programming

can a linux kernel module call libc functions?

can a linux kernel module call libc functions, such as printf(), strcpy(), etc...? (9 Replies)
Discussion started by: vistastar
9 Replies

9. Shell Programming and Scripting

Help: how to call fork() in shell script? New to linux

Hi, I'm writing a shell script where I want to call fork(). However I wrote like this "var=fork()" in c style and got this error: "syntax error near unexpected token `(' " How could I call fork() in shell script? Thanks in advance. Duplicate Post - Continue Here - Please Do Not Cross Post... (0 Replies)
Discussion started by: Xiaoya
0 Replies

10. Ubuntu

Help: how to call fork() in shell script? New to linux

Hi, I'm writing a shell script where I want to call fork(). However I wrote like this "var=fork()" in c style and got this error: "syntax error near unexpected token `(' " How could I call fork() in shell script? Thanks in advance. (2 Replies)
Discussion started by: Xiaoya
2 Replies
Data::FormValidator::ConstraintsFactory(3pm)		User Contributed Perl Documentation	      Data::FormValidator::ConstraintsFactory(3pm)

NAME
Data::FormValidator::ConstraintsFactory - Module to create constraints for HTML::FormValidator. DESCRIPTION
This module contains functions to help generate complex constraints. If you are writing new code, take a look at Data::FormValidator::Constraints::MethodsFactory instead. It's a modern alternative to what's here, offering improved names and syntax. SYNOPSIS
use Data::FormValidator::ConstraintsFactory qw( :set :bool ); constraints => { param1 => make_or_constraint( make_num_set_constraint( -1, ( 1 .. 10 ) ), make_set_constraint( 1, ( 20 .. 30 ) ), ), province => make_word_set_constraint( 1, "AB QC ON TN NU" ), bid => make_range_constraint( 1, 1, 10 ), } BOOLEAN CONSTRAINTS
Those constraints are available by using the ":bool" tag. make_not_constraint( $c1 ) This will create a constraint that will return the negation of the result of constraint $c1. make_or_constraint( @constraints ) This will create a constraint that will return the result of the first constraint that return an non false result. make_and_constraint( @constraints ) This will create a constraint that will return the result of the first constraint that return an non false result only if all constraints returns a non-false results. SET CONSTRAINTS
Those constraints are available by using the ":set" tag. make_set_constraint( $res, @elements ) This will create a constraint that will return $res if the value is one of the @elements set, or the negation of $res otherwise. The "eq" operator is used for comparison. make_num_set_constraint( $res, @elements ) This will create a constraint that will return $res if the value is one of the @elements set, or the negation of $res otherwise. The "==" operator is used for comparison. make_word_set_constraint( $res, $set ) This will create a constraint that will return $res if the value is a word in $set, or the negation of $res otherwise. make_cmp_set_constraint( $res, $cmp, @elements ) This will create a constraint that will return $res if the value is one of the @elements set, or the negation of $res otherwise. $cmp is a function which takes two argument and should return true or false depending if the two elements are equal. NUMERICAL LOGICAL CONSTRAINTS
Those constraints are available by using the ":num" tag. make_clamp_constraint( $res, $low, $high ) This will create a constraint that will return $res if the value is between $low and $high bounds included or its negation otherwise. make_lt_constraint( $res, $bound ) This will create a constraint that will return $res if the value is lower than $bound, or the negation of $res otherwise. make_le_constraint( $res, $bound ) This will create a constraint that will return $res if the value is lower or equal than $bound, or the negation of $res otherwise. make_gt_constraint( $res, $bound ) This will create a constraint that will return $res if the value is greater than $bound, or the negation of $res otherwise. make_ge_constraint( $res, $bound ) This will create a constraint that will return $res if the value is greater or equal than $bound, or the negation of $res otherwise. OTHER CONSTRAINTS
make_length_constraint($max_length) This will create a constraint that will return true if the value has a length of less than or equal to $max_length SEE ALSO
Data::FormValidator(3) AUTHOR
Author: Francis J. Lacoste <francis.lacoste@iNsu.COM> Maintainer: Mark Stosberg <mark@summersault.com> COPYRIGHT
Copyright (c) 2000 iNsu Innovations Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms as perl itself. perl v5.14.2 2011-11-25 Data::FormValidator::ConstraintsFactory(3pm)
All times are GMT -4. The time now is 10:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy