|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I am working on a project where I have to generate and execute nasm code on-the-fly. I generate the code in a file program.asm and then execute it.This output is to stdout which i redirect to an output file which i read back to compare results: system("nasm -f elf program.asm > output"); The problem is I have to do this process (generate code and execute) a lot of times each time i run my program which slows the execution time due to so much file I/O. Is there some shell trick by which I can generate my code in a string buffer (instead of the file program.asm) and pass it as input to nasm. Similarly, can I capture the output of nasm into another string buffer without writing it to a file. Same applies for compiling c programs using gcc. Can my c program be present in a string which i then compile using gcc by redirecting its input from a file to the string. Likewise, can i redirect the output of my c program to a string instead of stdout or any other file before. |
| Sponsored Links | |
|
|
|
#2
|
|||
|
|||
|
Perhaps using a tmpfs based filesystem would improve the performance enough.
|
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Thanks for the reply but I don't have that option.
Anyways, I found a way to redirect stdout to a string. Its at Get from stdout a string - GIDForums This method uses pipes. Haven't tried it yet but seems it will work. Any similar ideas for taking input from a string or some memory buffer instead of files?? |
|
#4
|
|||
|
|||
|
What OS are you running that doesn't support a memory backed filesystem ?
Quote:
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Quote:
How can I use it ? I am using ubuntu 9.04. ---------- Post updated at 10:56 AM ---------- Previous update was at 10:56 AM ---------- |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Google first hit: Create turbocharged storage using tmpfs
|
| Sponsored Links | ||
|
|
![]() |
| Tags |
| on-the-fly, redirect, stdout, string |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can't close stdin/stdout in shell | Corona688 | Shell Programming and Scripting | 10 | 02-18-2010 07:52 PM |
| Redirecting stdin from fd 3-9? | niceguyeddie | Shell Programming and Scripting | 3 | 09-03-2009 04:13 PM |
| stdout/stdin + flushing buffers | JamesGoh | Programming | 9 | 10-02-2008 08:15 PM |
| C++ How to use pipe() & fork() with stdin and stdout to another program | vvaidyan | Programming | 2 | 05-16-2008 07:30 PM |
| Redirecting to stdin | flame_eagle | Shell Programming and Scripting | 4 | 02-20-2008 03:25 PM |
|
|