Skip to main content
gamedev.net
🔒 Locked

File manipulation

Started by Leyder Dylan Aug 15, 2001 at 1:17 PM 0 replies 250+ views
Original Post
Leyder Dylan
Leyder Dylan
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/
Dragonus
Dragonus
I think this (or something like it will work)...

  
char line[500]; // 500 can be changed

FILE* 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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.