does anyone know a program split a c source into many c files, where each c file contains a function of the initial c source?
example:
this file: -
//file myprog.c ------------------
-
#include<stdio.h>
-
int a(int a, int b){
-
return a+b;
-
}
-
-
int b(int a, int b){
-
return a*b;
-
}
-
-
int main(){
-
printf("a(10,10)=%d\n",a(10,10));
-
printf("b(10,10)=%d\n",b(10,10));
-
}
-
//end of file myprog.c------------------------
-
turn into these files: -
//file a.h--------------------------------------------
-
int a(int a, int b);
-
//end of file a.h---------------------------------------
-
-
// file a.c -------------------------------------------
-
#include "a.h"
-
-
int a(int a, int b){
-
return a+b;
-
}
-
//end of file a.c--------------------------------------
-
-
-
//file b.h-----------------------------------------
-
int b(int a,int b);
-
//end of file b.h---------------------------------
-
-
//file b.c-------------------------------------------
-
#include "b.h"
-
-
int b(int a, int b){
-
return a*b;
-
}
-
//end of file b.c----------------------------------
-
-
//file main.c ------------------------------
-
#include <stdio.h>
-
#include "a.h"
-
#include "b.h"
-
-
int main(){
-
printf("a(10,10)=%d\n",a(10,10));
-
printf("b(10,10)=%d\n",b(10,10));
-
}
-
//end of file myprog.c ------------------------------
-
thanks for the help!
2 1216
No, I don't.
Usually, code is written in many source files each with a header so there's not much call for a program like that.
Personally I would just build the files manually by cut/paste from the original file.
oh, then I have a big problem.
I need to do this on some benchmarks, and one of these benchmarks has 288 ".c" files =/
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Krish |
last post by:
I have requirement, that i get one big chunk of text file. This text file
will have has information, that on finding "****End of Information****", i
have to split them individual text file with our naming standard (unique id)
and create them designated folder.
This requirement should be created as a batch job and preferrably this job
should monitor the folder where one big chunk of text file lands and process
them immediately.
...
|
by: Nicolas |
last post by:
How to store multiple files in only one sql blod field in sql database
Like I got a record for a house:
ID
Name
addresss
price
attachments
The field "attachments" may contains documents (pictures, word file for
specification, autocad file for the plan etc.) We don't know in advance on
many attachments will be uploaded. I should be able to Insert, Update,
|
by: Stefan Schwarzer |
last post by:
Hello,
from time to time I want to inspect the source code of projects
on remote computers.(*) I've googled for one or two hours but
didn't find anything helpful. :-/ I'm looking for something like
IDLE's path browser - i. e. a tree view and file view
side-by-side - but with the following differences:
- doesn't need an X connection to the remote computer where the
sources are
|
by: jonathan184 |
last post by:
trying to rename filenames and extensions then add a header in line1 of each file
if the header existed in line 1 to go to the next file.
but i am getting error explciti errors
Here is my code I am using
#!/usr/bin/perl
user warnings;
|
by: lyealain |
last post by:
how to store many files in one database fields?? i manage to store one file into database field.. but fail to store many files.....
how should i do that>> one database field for many files name.. is this way correct???
or each field for one filename?? 10 fields for 10 files??
| |
by: Bob Bedford |
last post by:
Hi all,
I've an XML file that takes more than the hosting time limit to be readed by
a PHP script.
What I'd like to do is split the large XML file (can be more than 30MB) in
little parts and keep the header for every file.
Here is the idea:
|
by: developing |
last post by:
Hello people, I downloaded a few open source frameworks in hopes of looking at the source and learning a few things. All was fine till I got totally lost on where to start.
i downloaded the source for *nix...
eg: I downloaded the source for php framework. Now I want to see how 'echo' function is implemented...I can't figure out where to look.
Same thing with an app called 'wireshark'...i downloaded the source for mac os x, but i cant...
|
by: K. |
last post by:
Hello!
Is it possible to create i.e. truck.gz compressed file, which
contains i.e. 4 files: truck1.jpg, truck2.jpg, truck3.jpg, truck4.jpg?
If so, how should I implement such code to achieve this using gzwrite and
any other functions?
I couldn`t find the example on internet.
|
by: maxjessop |
last post by:
Hi, I have a .txt file with blocks of text separated by blank lines. I need to save each block into separate .txt files on the server.
I am a complete novice and so far only managed to load the .txt and echo it back. I've spent two days searching for examples but have come up blank, I think explode() into an array and then write the arrays to txt files is the way to go. Any help would be appreciated thanks.
|
by: thistle |
last post by:
I have this code to merge files. the files language is persian. it merges them but I want each file to be written in a new line. for example if I have 9 files, the output should be 9 lines. each line is one file. the problem is that I don't know where to put replace('\n', " ") to omit newlines of a file and where to add '\n' to go to the next file.
import os,shutil
path = 'فناوري'
f=open("wwww.txt","a", encoding = 'utf-8')
for r,d,fi in...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |