Comments (1)
I am not sure if this helps or not, but seems to work ok.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sds.h"
#include "sdsalloc.h"
int main( int argc, char *argv[] )
{
sds *tokens;
int count, j;
FILE *fp;
char path[10350];
/* Open the command for reading. */
fp = popen("/usr/bin/find /home/user/Desktop/|tr '/' '_'", "r");
if (fp == NULL) {
printf("Failed to run command\n" );
exit(1);
}
/* Read the output a line at a time - output it. */
while (fgets(path, sizeof(path)-1, fp) != NULL) {
{
sds y = sdsnew(path);
printf("%s",y);
sds line = sdsnew(y);
tokens = sdssplitlen(line,sdslen(line),"home_user",9,&count);
for (j = 0; j < count; j++)
printf("%s\n", tokens[j]);
sdsfreesplitres(tokens,count);
}}
/* close */
pclose(fp);
return 0;
}
from sds.
Related Issues (20)
- Dead Store v.2.0.0
- Error in example HOT 1
- sds and interrupts
- Some confusions on sdshdr5 & sdshdr8 on key/value actual memory usage and MEMORY USAGE command HOT 1
- malloc/realloc only powers of two? HOT 1
- sdscat & sdscatsds in-place? HOT 1
- Question: Violation of Strict Aliasing Rule ? HOT 3
- sdscatfmt doesn't support flags
- How can i clear the string without freeing it?
- Maintenance? HOT 3
- Unexpected behaviour HOT 1
- Generate libsds.so HOT 2
- Potential integer overflow in sds.c
- Potential undefined behavior when negating value in sdsll2str
- README mistake: sdstrim does not return void
- SDS version 2 compilation error with visual c++ compiler. HOT 3
- Make install target HOT 1
- Using sds in embedded environment, even on Arduino? HOT 2
- Null Dereferences v2.0.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sds.