Hi all,
Right now I'm using this but it seems to be a hack:
if (prefix(arg, "mark=")) {
for (markid = strtok(args,"="); markid; markid=strtok((char *)NULL, "=")) {
basically the user passes "mark=ny" to the command. I want to be able to extract "ny" from that... (7 Replies)
can any help me out y dis program is giving me a segmentation fault.....
#include<stdio.h>
#include<string.h>
int main()
{
char *str="Tanvir/home/root/hello";
const char *d ="/";
char *ret;
ret=strtok(str,d);
if(ret==NULL)
printf("NULL NULL");
else
... (3 Replies)
Hi,
I just wrote a program in C to split a comma seperated string in to group of strings using strtok() function. The code is:
int main()
{
char *temp;//not used here but basically we extract one string after another using strtok() and assign to a string pointer defined like this.
... (3 Replies)
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)
Why is line (null) after the first while loop run? (keyword does jump to the next word.)
#include <ftw.h>
#include <stdio.h>
#include <string.h>
char filenames = "";
int list(const char *name, const struct stat *status, int type)
{
if( (type == FTW_F) && strstr(name, ".txt") &&... (3 Replies)
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)
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)
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)