Advertisement

File manipulation

Started by August 15, 2001 01:17 PM
0 comments, last by Leyder Dylan 23 years, 6 months ago
Hi, I''ve a file. In this file, I''ve : Begin Map Begin Actor Class=LevelInfo Name=LevelInfo1 TimeSeconds=13.775536 AIProfile(0)=166 Level=LevelInfo''MyLevel.LevelInfo1'' Tag=LevelInfo Region=(Zone=LevelInfo''MyLevel.LevelInfo1'',iLeaf=-1) Name=LevelInfo1 End Actor Begin Actor Class=Brush Name=Brush1 MainScale=(SheerAxis=SHEER_ZX) PostScale=(SheerAxis=SHEER_ZX) Group=Sheet Level=LevelInfo''MyLevel.LevelInfo1'' Tag=Brush Region=(Zone=LevelInfo''MyLevel.LevelInfo1'',iLeaf=-1) Begin Brush Name=Brush Begin PolyList Begin Polygon Item=Sheet Flags=264 Origin +00128.000000,+00128.000000,+00000.000000 Normal +00000.000000,+00000.000000,-00001.000000 TextureU -00001.000000,+00000.000000,+00000.000000 TextureV +00000.000000,+00001.000000,+00000.000000 Vertex +00128.000000,+00128.000000,+00000.000000 Vertex +00128.000000,-00128.000000,+00000.000000 Vertex -00128.000000,-00128.000000,+00000.000000 Vertex -00128.000000,+00128.000000,+00000.000000 End Polygon End PolyList End Brush Brush=Model''MyLevel.Brush'' Name=Brush1 End Actor End Map I''d like to only conserve this part and writting in another file : TextureU -1.000000,0.000000,0.000000 TextureV 0.000000,1.000000,0.000000 Vertex 128.000000,128.000000,0.000000 Vertex 128.000000,-128.000000,0.000000 Vertex -128.000000,-128.000000,0.000000 Vertex -128.000000,128.000000,0.000000 How can I do ? ======================== Leyder Dylan http://ibelgique.ifrance.com/Slug-Production/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
I think this (or something like it will work)...

  char line[500];  // 500 can be changedFILE* fin = fopen("input.txt", "r");FILE* fout = fopen("output.txt", "w");fgets(line, 500, fin);float x = 0, y = 0, z = 0;if(sscan("TextureU %f,%f,%f", &x, &y, &z) == 3))    fprintf(fout, "TextureU %f,%f,%f", x, y, z);else if(sscan("TextureV %f,%f,%f", &x, &y, &z) == 3))    fprintf(fout, "TextureV %f,%f,%f", x, y, z);else if(sscan("Vertex %f,%f,%f", &x, &y, &z) == 3))    fprintf(fout, "Vertex %f,%f,%f", x, y, z);  


Then just shove that into a for- or while-loop testing for feof() and you should be able to get by that way.

~ Dragonus

This topic is closed to new replies.

Advertisement