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 1209
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...
|
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...
|
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...
|
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...
|
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.....
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| | |