Click here to Skip to main content
13,053,845 members (58,014 online)
Rate this:
Please Sign up or sign in to vote.
See more:
so here it is, I really dont know how to program

here the problem :

I have a file .txt format, in which there are many number sequentially down.
for example :

eg: my data have 100 number down, I have to divide them into 10 parts. later the file become 10 file .txt format, in which there are number 1 - 10 (part one), 11 - 20 (part two), 21 - 30, etc ...

and the program must be made from C++. Thanks for help
Posted 23-Mar-13 3:44am
ThePhantomUpvoter 23-Mar-13 10:01am
So open the file, read 10 lines from the file, write to first file, read next 10, write to next file. What is the problem exactly?
moonstalker 23-Mar-13 14:50pm
the problem is I noob in programming >,<
ThePhantomUpvoter 23-Mar-13 17:34pm
No that is not a problem at all. Being a "noob" is meaningless. Either you have tried to do it yourself or not. If you have tried to do it yourself you must have run into some problem. If you have not tried it yourself then this is just being lazy and getting someone to do your own work for you.
moonstalker 24-Mar-13 10:35am
how do you know? >,<
my knowledge for programming is low, I learned pseudocode only before. And I no idea to convert it to code
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I code it in C,
int main(int argc, char** argv){
        int i,j;
        char filename[6],context[10];
        strcpy(filename, "0.txt");
        for(i=0; i<10; i++){
                filename[0] = '0'+i;
                for(j=0; j<10; j++){
                        context[strlen(context)] = '\n';
        return 0;

C++ is the same.
moonstalker 24-Mar-13 10:37am
thank you anyway, I will try this
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This should get you on your way:[^]

There should be lots of options if you use Google[^]
moonstalker 23-Mar-13 14:51pm
ok, I will try this, thanks
H.Brydon 23-Mar-13 17:27pm
The msdn link you provide is for C++/CLI and won't work for generic C++.
Most of the hits at the google search are also C++/CLI.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 23 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100