need help w/ multiple file handles

This is a discussion on need help w/ multiple file handles within the C Programming forums, part of the General Programming Boards category; Hi, I need to write a program which reads in some data file and in the event of the occurance ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    2

    Question need help w/ multiple file handles

    Hi, I need to write a program which reads in some data file and in the event of
    the occurance of a certain phrase writes something to an output file. Now the problem is that this phrase might occur more than just once in that data file so
    I would need to open another file handle once I trip over that phrase again.
    Well, is there anybody who can help me solve this problem ?

    PS: I had to write that program for a UNISYS (if anyone knows what that is)
    which is why I don't bother typing the true code here, it'd be too long and misleading. It is very important though that your suggestions are in Ansi-C since that unisys machine only accepts that.

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    3
    We also have a UNISYS mainframe but all our mainframe programmers use cobol. Is C an extra package that you loaded on your mainframe?

    As far as the multiple handles why can't you just keep using the same data file or do you have to seperate them? If you need to seperate them you could just write it all to one file then make another function to seperate them after.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You're joking right?

    FILE *fp1, *fp2, *fp3 ...;

    There. Now you have multiple file handles in ANSI C.
    Hell, you can even use an array:

    FILE *fp[256];

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    2
    well, i'm going to try that *fp[256] stuff, hope it works.
    BTW, I'm actually the only unlucky guy (along w/another colleague) who's got to do C on that unisys. The other guys do cobol as well.

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    3

    UNISYS C

    Is your UNISYS a clearpath? I am intrested in programming for out mainframe in C but we do not have it on there that I know of. I looked at the UNISYS website and they only talk about having java for the UNISYS (at least for MCP). I have been using a pc to connect to out databases on the mainframe using visual basic I am not to thrilled about vb so if you have to info on using C on the UNISYS I would be glad to hear about it...

  6. #6
    Unregistered
    Guest
    I don't know about that clearpath stuff. I'm actually not that familiar with the UNISYS in general, what I know is basically what I need in order to develop for that mainframe. So it goes like this: I write C codeusing Borland CBuilder or UltraEdit, then I send it to the mainframe via an ftp-connect, then I open a terminal emulation program which is called Info-connect that lets me work right on the mainframe itself. Yeah, when I fire Infoconnect up, it says UNISYS operating environment v1100/2200 or something similar like this. What comes now is a bit hard to explain, but I'll try: Assuming the code's been uploaded successfully, I'll do something like "ADD filename-ext/L" in the workspace which compiles the source file. I usually then do "BRK" and then "L ERROR" which lists all errors and warnings generated by the compiler. If everything went alright, I eventually type "ADD filename/R" which generates a run. Again, if looking at the BRK-file does not bring up errors I go ahead and transfer whatever output the program did via FTP to my workstation to have a much more comfortable look at it.
    I've got some information on how to program in C @work, I could of course copy some of those guidelines, so if anyone's interested, write me an email: friesengeist@hotmail.com
    Oh, I forgot something: those guidelines are in GERMAN.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01:36 PM
  2. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 01:13 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21