473,396 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Running programs in a batch

hello all,
i have around 200 .csv files.
i have written a code which opens one file, sorts the data in the file and gives the required output.
i have to do this for all the 200 files.
should i change the file name in the fopen statement everytime and run the program 200 times?
or is it possible to analyse all the files at a time (in a batch)
any help will be highly appreciated

thanks
Jan 26 '07 #1
2 1159
horace1
1,510 Expert 1GB
hello all,
i have around 200 .csv files.
i have written a code which opens one file, sorts the data in the file and gives the required output.
i have to do this for all the 200 files.
should i change the file name in the fopen statement everytime and run the program 200 times?
or is it possible to analyse all the files at a time (in a batch)
any help will be highly appreciated

thanks
if your filenames have some consistent nameing system you could have a loop which creates the filename then opens and processes it. e.g. assuming your files were called file1, file2, file3, etc
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int i;
  6.     for (i=1;i<=20; i++)
  7.       {
  8.        char filename[20]="file", number[10];
  9.        sprintf(number,"%d", i);    // convert number to characters
  10.        strcat(filename, number);   // append on end of filename
  11.        printf("filename %s\n", filename);
  12.        // ** open file and process it
  13.        }
  14.       getchar();       
  15. }
  16.  
prints
filename file1
filename file2
filename file3
filename file4
filename file5
filename file6
filename file7
filename file8
filename file9
filename file10
filename file11
filename file12
filename file13
filename file14
filename file15
filename file16
filename file17
filename file18
filename file19
filename file20
Jan 26 '07 #2
thankyou
i will try it out

madhankrish
Jan 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kris | last post by:
Is it possible to run batch programs under OWF control? I need to use SQL Loader working under OWF. Regards, Kris
29
by: pb648174 | last post by:
I have a very long transaction that runs on the same database that other users need to use for existing data. I don't care if they see data from the transaction before it is done and am only using...
1
by: James Li | last post by:
I have a windows form application (C#) that launches multiple external batch files to do various installation tasks. I want to show some status on the win form, say simply update the text on a...
0
by: joeted | last post by:
Hi, I am using system.diagnostic.process with the intention of running a program to communicate with a unix box: The program is "PuTTY", running from a batch script. I know it works because...
9
by: Atley | last post by:
I am looking for a way to run DOS-type commands from within a VB.net 2003 application. I also need to be able to answer questions (ie 'Are You Sure') that the command line may require. ...
4
by: Shiraz | last post by:
Hi I'm using Visual Studio Installer to make my installer, and have not as yet figured out a straightforward way to use it to set environmental variables. Amongst the various things I tried, I'm...
11
by: news | last post by:
I've a PHP script that does some stuff, zips up some files, and starts an FTP process. I need it to do the Zip and FTP in the background and let the page finish, otherwise the user could have...
5
by: Screaming Eagles 101 | last post by:
Hi , not much trouble in making a setup project, but I'd like also an icon in All Programs to uninstall the application. I can't find a good explanation on the net so far... -- Filip...
0
by: sunrt | last post by:
We have an As400 system that has program which executes batch files which resides on the SQL server 7.0 computer . Those batch files run SQL server jobs using isql. The whole idea about this is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.