05-12-2009
Pls check below source.
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
int main()
{
char p[] = "12.63";
char *pTok = strtok(p, ".");
int num1 = atoi(pTok);
cout << num1 << endl;
while(pTok)
{
pTok = strtok(NULL, ".");
if(pTok)
{
int num = atoi(pTok);
cout << num << endl;
}
}
return 0;
}
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
i want to read a text file whose content(single line) will be a number like 1 or 2 or 3 ..... what i want to do is to read the file and increment the content of the file, using unix scripting.
Regards,
Senthil Kumar Siddhan. (2 Replies)
Discussion started by: senthilk615
2 Replies
2. UNIX for Dummies Questions & Answers
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)
Discussion started by: csnmgeek
2 Replies
3. Shell Programming and Scripting
Hi,
i'd like to implmeent emergency shutdown script in case our AC dies and the temperature rises too high.
I can get core temperatures with:
sensors | grep Core | cut -c15-16
Result is:
23
18
18
13
21
18
15
17
How can I check if any of the cores is above eg. 80 (that's C of... (2 Replies)
Discussion started by: zapp0
2 Replies
4. Shell Programming and Scripting
hello guys i m new to shell scripting and can't find out why this structure is not right
I m guessing this happens because $LINESUM is a string . so how can i do this ?
i want my script to do so many loops as the number of the lines of one custom file.
#!/bin/bash
echo give me path name... (5 Replies)
Discussion started by: xamxam
5 Replies
5. Programming
Hi,
from the manual
listen(2): listen for connections on socket - Linux man page
It has a parameter called backlog and it limits the maximum length of queue of pending list.
If I set backlog to 128, is it means no more than 128 packets can be handled by server?
If I have three... (3 Replies)
Discussion started by: sehang
3 Replies
6. Programming
hi
I want to write a function which takes int as input and returns a string like this.
char GetString(int iNo)
{
switch(iNo)
{
case 0:
return "Zero";
break;
case 1:
return "One";
break;
}
}
void main()
{
int i;
printf("Enter... (1 Reply)
Discussion started by: atharalikhan
1 Replies
7. Shell Programming and Scripting
Hi,
I have the following requirement.
There will be following text/line in a file (eg: search-build.txt)
PRODUCT_VERSION="V:01.002.007.Build1234"
I need to update the incremental build number (eg here 007) every time I give a build through script. I am able to search the string and get... (4 Replies)
Discussion started by: drwatson_droid
4 Replies
8. Programming
Does anyone know how to convert a IP address given as 'string' into a 'u_int32_t'? Are there any build any functions already? (1 Reply)
Discussion started by: Freaky123
1 Replies
9. Programming
I have a string containing 2 integers separated by /, for example 12/8 or 8/6 am want to store the numbers in two integers. (3 Replies)
Discussion started by: kristinu
3 Replies
10. Shell Programming and Scripting
Hi,
I have column 5 in a file which contains string like this for ex.
RP11-125O5.2
SLCO1B1
CAPN1
FRMPD2
TXNL4B
So I do by
data = )]
ValueError: invalid literal for int() with base 10: 'R'
Can someday tell me how to convert this column into int successfully.
Thank You in... (7 Replies)
Discussion started by: rossi
7 Replies
LEARN ABOUT DEBIAN
tau_get_func_vals
TAU_GET_FUNC_VALS(3) TAU Instrumentation API TAU_GET_FUNC_VALS(3)
NAME
TAU_GET_FUNC_VALS - Gets detailed performance data for given functions
SYNOPSIS
C/C++:
TAU_GET_FUNC_VALS(const char **inFuncs, int numOfFuncs, double ***counterExclusiveValues, double ***counterInclusiveValues,
int **numOfCalls, int **numOfSubRoutines, const char ***counterNames, int *numOfCounters, int tid);
DESCRIPTION
It gets detailed performance data for the list of routines. The user specifies inFuncs and the number of routines; TAU then returns the
other arguments with the performance data. counterExclusiveValues and counterInclusiveValues are two dimensional arrays: the first
dimension is the routine id and the second is counter id. The value is indexed by these two dimensions. numCalls and numSubrs (or child
routines) are one dimensional arrays.
EXAMPLE
C/C++ :
const char **inFuncs;
/* The first dimension is functions, and the
second dimension is counters */
double **counterExclusiveValues;
double **counterInclusiveValues;
int *numOfCalls;
int *numOfSubRoutines;
const char **counterNames;
int numOfCouns;
TAU_GET_FUNC_NAMES(functionList, numOfFunctions);
/* We are only interested in the first two routines
that are executing in this context. So, we allocate
space for two routine names and get the performance
data for these two routines at runtime. */
if (numOfFunctions >=2 ) {
inFuncs = (const char **) malloc(sizeof(const char *) * 2);
inFuncs[0] = functionList[0];
inFuncs[1] = functionList[1];
//Just to show consistency.
TAU_DB_DUMP();
TAU_GET_FUNC_VALS(inFuncs, 2,
counterExclusiveValues,
counterInclusiveValues,
numOfCalls,
numOfSubRoutines,
counterNames,
numOfCouns);
TAU_DUMP_FUNC_VALS_INCR(inFuncs, 2);
cout << "@@@@@@@@@@@@@@@" << endl;
cout << "The number of counters is: " << numOfCouns << endl;
cout << "The first counter is: " << counterNames[0] << endl;
cout << "The Exclusive value of: " << inFuncs[0]
<< " is: " << counterExclusiveValues[0][0] << endl;
cout << "The numOfSubRoutines of: " << inFuncs[0]
<< " is: " << numOfSubRoutines[0]
<< endl;
cout << "The Inclusive value of: " << inFuncs[1]
<< " is: " << counterInclusiveValues[1][0]
<< endl;
cout << "The numOfCalls of: " << inFuncs[1]
<< " is: " << numOfCalls[1]
<< endl;
cout << "@@@@@@@@@@@@@@@" << endl;
}
TAU_DB_DUMP_INCR();
SEE ALSO
TAU_GET_COUNTER_NAMES(3), TAU_GET_FUNC_NAMES(3), TAU_DUMP_FUNC_NAMES(3), TAU_DUMP_FUNC_VALS(3)
08/31/2005 TAU_GET_FUNC_VALS(3)